Thread (14 messages) flat view 14 messages, 2 authors, 2020-07-17
STALE2234d REVIEWED: 1 (1M)

Revision v2 of 2 in this series; 1 review trailer.

Revisions (2)
  1. v2 [diff vs current]
  2. v2 current

[net-next PATCH v2 2/9] net: hsr/prp: validate address B before copying to skb

From: Murali Karicheri <hidden>
Date: 2020-07-15 16:41:32
Also in: lkml, netdev
Subsystem: hsr network protocol, networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

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

Signed-off-by: Murali Karicheri <redacted>
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help