From patchwork Fri Jul 17 14:52:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 235714 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1774401ilg; Fri, 17 Jul 2020 07:52:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2ASF8tHX/px7CNNPRu3UzXl/LN/uDsutkULUQhEsWoibdDIWvZ+ZAumA82GLcdONxD42K X-Received: by 2002:a17:906:538e:: with SMTP id g14mr8848879ejo.300.1594997537021; Fri, 17 Jul 2020 07:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594997537; cv=none; d=google.com; s=arc-20160816; b=L9E8aE+Py4PqHzq/Gl7jJYEG+GqVC/ReuQIRbH3obu4v6UzVIW5h/4WytyIqXe4Et9 vUS1OPltrk59KyswjXNbe1jcZGSHhtP0FHrVMma3ansURuHaPrub/ut/oZNVtEvW12cX zMgp1BU/kwzIcsmfqgollTmD8OyCbJ0RXc4XoGYJvOmQ+4nhlHO4JSJCAGbzQJk/XD0l N4ryqtnlYBVuoank8ntqTk/X6l7G064YZ+5ESJF8VozydhrVTaj+1eORaw4TnqNqKZtM wLqT1TaJFDlIcAhvVL7YMQV0dGyTDYyFreDgZC5OJc+nmF7aSjRGAmJthNrgkJounVrJ CYPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:to :from:dkim-signature; bh=/XNLy126QxHTb/EFUIqxH0/+6ffefnDzqmH+3zuj/o8=; b=cUDdVVm4kLOPBJxhlTDnK/Iz8QpSA7QPNFY00LrXDOocPVIarn1nxLfPbdEncz1a// RhSaaT9W0SX65Dq9vuDNsMKXCQc8Mzv01z5acG65FbK75ID9XqI6cmjuBC2SfSdKn70r YOoYdcePh2FhZAK6kC4+whzAs6e8EFrw1wiAjTHNJQeqdPquf8aEEWux8UuJ80jqyuRm nvIhPEuf8OZHyIw2qMZNCq+2vLnFUh2PZtyBXiUkHrLHwOuBkrZSXCKBpf5huaXQfFg0 Xvp34ZDH3/XfDBWFRzXRvE5VCzBa2VFF8k1KJj7guF1jCjEKRqQW7zrLSckXtBEI3E6f PY1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=a5yLAu28; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si5440637ejj.300.2020.07.17.07.52.16; Fri, 17 Jul 2020 07:52:17 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=a5yLAu28; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727096AbgGQOwH (ORCPT + 9 others); Fri, 17 Jul 2020 10:52:07 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:60286 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726828AbgGQOwH (ORCPT ); Fri, 17 Jul 2020 10:52:07 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06HEq2nA005973; Fri, 17 Jul 2020 09:52:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594997522; bh=/XNLy126QxHTb/EFUIqxH0/+6ffefnDzqmH+3zuj/o8=; h=From:To:Subject:Date; b=a5yLAu28txbuYiDfLje0f8yI0nz1gLSJH2UoptgxR7FFI2NMKbjazqQJ+f0s3w6ES aEuCzZKwzzY8w9Z+Vx7jaGoO8iCFuPiz2459j4CcpTBLoEAsANIEP7r6QwjVTakiU0 go0dyho+5WTBFekq0Pwv66jK/tYpKBJbDnqpCaRQ= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06HEq297030488 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 17 Jul 2020 09:52:02 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 17 Jul 2020 09:52:02 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 17 Jul 2020 09:52:01 -0500 Received: from uda0868495.fios-router.home (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06HEq1ic097948; Fri, 17 Jul 2020 09:52:01 -0500 From: Murali Karicheri To: , , , , , , Subject: [PATCH 1/2] net: hsr: fix incorrect lsdu size in the tag of HSR frames for small frames Date: Fri, 17 Jul 2020 10:52:00 -0400 Message-ID: <20200717145201.30351-1-m-karicheri2@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For small Ethernet frames with size less than minimum size 66 for HSR vs 60 for regular Ethernet frames, hsr driver currently doesn't pad the frame to make it minimum size. This results in incorrect LSDU size being populated in the HSR tag for these frames. Fix this by padding the frame to the minimum size applicable for HSR. Signed-off-by: Murali Karicheri --- Sending this bug fix ahead of PRP patch series as per comment net/hsr/hsr_forward.c | 3 +++ 1 file changed, 3 insertions(+) Sending this bug fix ahead of PRP patch series as per comment -- 2.17.1 diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c index ed13760463de..e42fd356f073 100644 --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c @@ -127,6 +127,9 @@ static void hsr_fill_tag(struct sk_buff *skb, struct hsr_frame_info *frame, int lane_id; int lsdu_size; + /* pad to minimum packet size which is 60 + 6 (HSR tag) */ + skb_put_padto(skb, ETH_ZLEN + HSR_HLEN); + if (port->type == HSR_PT_SLAVE_A) lane_id = 0; else From patchwork Fri Jul 17 14:52:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 235713 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1774321ilg; Fri, 17 Jul 2020 07:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYi1n3Dvai9/O6EvetZJdrO7F0+RaQph8+rJxQnYZZnopcMxn6id7990zcGuLqSfrcy8/k X-Received: by 2002:a05:6402:158d:: with SMTP id c13mr9729200edv.103.1594997530707; Fri, 17 Jul 2020 07:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594997530; cv=none; d=google.com; s=arc-20160816; b=RSXsma0VHjpcPkQOFD1BcT8gCEwovg+xCa3GkFH7x3C0SfTJpMhUV1dOXEgBDq9ua3 fGnLiwHXyHaHmpaczQnsSKTUB9JO8c8fqtpvvHz7NgeWDdV02atEtmuApsO1Atd7/tV6 /Z+9SB7vZjXAykA6xrL8ScGc82XPO5VXMb9dQbfj02vWQM5f5uLnkJl1hDKqidOeuVEd UstgTWwybQZ4LVvvSPy/AOVH5xV8deyHzrW8qA7XywZpEgmXmzfxSEafJWLG5TG2jpE6 WFYwH50Jq+VwLjwXQJnBmWH6wah9tPQGk5hId16/BR5/TRHYUcZScqaKhA4+pS+m39y9 5UxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=ESax+3izdT/pNkUAEDmi/F9+EPvqKK0Feoy+SCzspGE=; b=o4XNl7eXsmwGDps49JuhzTgBESR7xqedHQg+nMpDwVMXGmhgbXvr9deU4K2ggFJ3tp ue2tM9wdr1SsEOe9bHDyVe/+H+L9JV3Qm1zHuktkAyj3dK5WHR0RpCVIMfBWrwNrQ6pk KUtQkKV6zVKCwgC3LPfKBE6r6vV1jMxoT9XjjmD1G7Wx56QqSVxLj7Im4q4gNt/dCdnV cAThEo+rligpRjZ2mJBbJNYJNhvksJzdbcU7iZTwMyTOiF5gJ0cljifaV1vzVdJmW6nU FZurXn9IA2MX4NLdSQhrXqMj2ApNUOy6/wXSfpGGaPe5i4JymvNKFbI2SkE8Mei2Iae7 ANcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Jv4ubuD6; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du1si6817200ejc.616.2020.07.17.07.52.10; Fri, 17 Jul 2020 07:52:10 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Jv4ubuD6; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728081AbgGQOwI (ORCPT + 9 others); Fri, 17 Jul 2020 10:52:08 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:44088 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727032AbgGQOwI (ORCPT ); Fri, 17 Jul 2020 10:52:08 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06HEq3Wf008551; Fri, 17 Jul 2020 09:52:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594997523; bh=ESax+3izdT/pNkUAEDmi/F9+EPvqKK0Feoy+SCzspGE=; h=From:To:Subject:Date:In-Reply-To:References; b=Jv4ubuD6RpjD+pUdhFVM1Pv+K8YTkHWQRJo2MhzCSD6V1uc6V1lqyjjqyHH/4D24m AmMjYyrzm565dY/s4f9igIJqPCr+Plr4maydVvkhyE0FKG8WhU9NWoU1/hPBz7gUkD n3j6puc4iAm0P+vKi91yU8Yy5aawmXUkTiVcgkIM= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06HEq3Aw067492 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 17 Jul 2020 09:52:03 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 17 Jul 2020 09:52:02 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 17 Jul 2020 09:52:02 -0500 Received: from uda0868495.fios-router.home (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06HEq1id097948; Fri, 17 Jul 2020 09:52:02 -0500 From: Murali Karicheri To: , , , , , , Subject: [PATCH 2/2] net: hsr/prp: validate address B before copying to skb Date: Fri, 17 Jul 2020 10:52:01 -0400 Message-ID: <20200717145201.30351-2-m-karicheri2@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200717145201.30351-1-m-karicheri2@ti.com> References: <20200717145201.30351-1-m-karicheri2@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Validate MAC address before copying the same to outgoing frame skb destination address. Since a node can have zero mac address for Link B until a valid frame is received over that link, this fix address the issue of a zero MAC address being in the packet. Signed-off-by: Murali Karicheri --- Sending this bug fix ahead of PRP patch series as per comment net/hsr/hsr_framereg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 03b891904314..530de24b1fb5 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c @@ -325,7 +325,8 @@ void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb, if (port->type != node_dst->addr_B_port) return; - ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B); + if (is_valid_ether_addr(node_dst->macaddress_B)) + ether_addr_copy(eth_hdr(skb)->h_dest, node_dst->macaddress_B); } void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,