From patchwork Wed Jul 15 16:40:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 235617 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp30678ilg; Wed, 15 Jul 2020 09:41:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIPK8l3S6gt4K0S3uAbfGJSSNGA1viOof9JnEXHSXPhp0sgBsztnwI29cPeHaxlyP5G8fQ X-Received: by 2002:a50:8adb:: with SMTP id k27mr418088edk.267.1594831293943; Wed, 15 Jul 2020 09:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594831293; cv=none; d=google.com; s=arc-20160816; b=IozI96sHS7Yl7n6Pw+vjGUJ5Kl8RsfJDyi3Bwnu7YVFqptltUa0PZybmrbDpcfEMfR TkUQAgvv2aTUQJhxrlCB4pls4LGe98tl/4grkXDfZ28OuCvPF7vDLgRKj3M3Ke0joOMm 4RBniG2pOiwBJLD6qBM/mwJj7QNg/4bxsS5WBYi4K20vjTdlu+uNwtwfhNZpSc8PFn+G w2A4zOPlRxh0N9qzG/8sqYyMaL0cFoh5WvG/mIlt7qhoKx2ImX+HHBADznHLDIKSJt6v nUYNmoLKWYf8t56JRwwrXy05AS1mK+IP47JF7pU+nkPzXFzxRnvt8iY3XZ+6WCuWynuz YPWw== 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=BuX2JcVEQqV62DWLE9gR2zCSbXY0NQedT0rYaZKFrdg=; b=fAEi8v+o4CdTlgFQbLkeuiClkEbpTj/8yla0EyQX1LCM/snI/r/KmQ5rVi/7lOCP9O KKUBe3mCXFUMi32LrUruquXOgMx7MjMY9jZHf9fIjbPTsa3nELLes+dvUZHsIqk2YV/6 tEks7TEoT+A4EI38aBqKHx3meyejIvOgUnzigsaybeTejs+r27e+/cVvBmHR87x5j8HL iA8GYc1Q0+fbL0apVc4YCQyYujJfmdlYOVJPu4hKOjH6ajTcFT7cz5UPMDDmB77SY/8i DrUFwjG4maLL4gvOmupuptgpJLk/VJSoQfYlZJv2ysY+KVKTcn5viZrrZngVzL0BNI0H Wnjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="Haa/5XR2"; 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 i25si1514302ejy.603.2020.07.15.09.41.33; Wed, 15 Jul 2020 09:41:33 -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="Haa/5XR2"; 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 S1726963AbgGOQk1 (ORCPT + 9 others); Wed, 15 Jul 2020 12:40:27 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:43486 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbgGOQkY (ORCPT ); Wed, 15 Jul 2020 12:40:24 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06FGeH7V021720; Wed, 15 Jul 2020 11:40:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594831217; bh=BuX2JcVEQqV62DWLE9gR2zCSbXY0NQedT0rYaZKFrdg=; h=From:To:Subject:Date:In-Reply-To:References; b=Haa/5XR2bKSvw86Yfu2C2eKRToy0xBTLSrFH774p7ABVxG5aganh45pqgUYfx9eqF 0MKGtA3Ww5P4lckqlZBGrH9/DiYiW8N84R+Mtvx1YTJir2wHaRFV13Ff9Bt51X8miU x5gLAujhYrYaTbN0yWscW5yYkjAk0p95v2duTbTw= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06FGeHUR102690 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 15 Jul 2020 11:40:17 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 15 Jul 2020 11:40:17 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE100.ent.ti.com (157.170.170.30) 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; Wed, 15 Jul 2020 11:40:17 -0500 Received: from uda0868495.fios-router.home (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06FGeCva081717; Wed, 15 Jul 2020 11:40:16 -0500 From: Murali Karicheri To: , , , , , , , Subject: [net-next PATCH v2 2/9] net: hsr/prp: validate address B before copying to skb Date: Wed, 15 Jul 2020 12:40:03 -0400 Message-ID: <20200715164012.1222-3-m-karicheri2@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200715164012.1222-1-m-karicheri2@ti.com> References: <20200715164012.1222-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. Signed-off-by: Murali Karicheri Reviewed-by: Grygorii Strashko --- net/hsr/hsr_framereg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 03b891904314..01331da28639 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c @@ -325,7 +325,10 @@ 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); + else + WARN_ONCE(1, "%s: mac address B not valid\n", __func__); } void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,