linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Murali Karicheri <m-karicheri2@ti.com>
To: <davem@davemloft.net>, <kuba@kernel.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-api@vger.kernel.org>, <nsekhar@ti.com>,
	<grygorii.strashko@ti.com>, <vinicius.gomes@intel.com>
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	[thread overview]
Message-ID: <20200715164012.1222-3-m-karicheri2@ti.com> (raw)
In-Reply-To: <20200715164012.1222-1-m-karicheri2@ti.com>

Validate MAC address before copying the same to outgoing frame
skb destination address.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 net/hsr/hsr_framereg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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,
-- 
2.17.1


  parent reply	other threads:[~2020-07-15 16:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 16:40 [net-next PATCH v2 0/9] Add PRP driver and bug fixes Murali Karicheri
2020-07-15 16:40 ` [net-next PATCH v2 1/9] net: hsr: fix incorrect lsdu size in the tag of HSR frames for small frames Murali Karicheri
2020-07-15 16:40 ` Murali Karicheri [this message]
2020-07-15 16:40 ` [net-next PATCH v2 3/9] hsr: enhance netlink socket interface to support PRP Murali Karicheri
2020-07-15 16:40 ` [net-next PATCH v2 4/9] net: hsr: introduce common code for skb initialization Murali Karicheri
2020-07-15 16:40 ` [net-next PATCH v2 5/9] net: hsr: introduce protocol specific function pointers Murali Karicheri
2020-07-15 16:40 ` [net-next PATCH v2 6/9] net: prp: add supervision frame generation utility function Murali Karicheri
2020-07-15 16:40 ` [net-next PATCH v2 7/9] net: hsr: define and use proto_ops ptrs to handle hsr specific frames Murali Karicheri
2020-07-15 16:40 ` [net-next PATCH v2 8/9] net: prp: add packet handling support Murali Karicheri
2020-07-15 16:40 ` [net-next PATCH v2 9/9] net: prp: enhance debugfs to display PRP info Murali Karicheri
2020-07-15 16:40 ` [net-next iproute2 PATCH v2 1/2] iplink: hsr: add support for creating PRP device similar to HSR Murali Karicheri
2020-07-15 16:40 ` [net-next iproute2 PATCH v2 2/2] ip: iplink: prp: update man page for new parameter Murali Karicheri
2020-07-16 23:56 ` [net-next PATCH v2 0/9] Add PRP driver and bug fixes Jakub Kicinski
2020-07-17 14:19   ` Murali Karicheri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200715164012.1222-3-m-karicheri2@ti.com \
    --to=m-karicheri2@ti.com \
    --cc=davem@davemloft.net \
    --cc=grygorii.strashko@ti.com \
    --cc=kuba@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=vinicius.gomes@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).