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,