diff mbox series

[2/2,v2] net: hsr: validate address B before copying to skb

Message ID 20200717145510.30433-2-m-karicheri2@ti.com
State New
Headers show
Series [1/2,v2] net: hsr: fix incorrect lsdu size in the tag of HSR frames for small frames | expand

Commit Message

Murali Karicheri July 17, 2020, 2:55 p.m. UTC
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 <m-karicheri2@ti.com>

---
 Removing prp prefix from subject line.
 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

Comments

David Miller July 18, 2020, 1:54 a.m. UTC | #1
From: Murali Karicheri <m-karicheri2@ti.com>

Date: Fri, 17 Jul 2020 10:55:10 -0400

> 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 <m-karicheri2@ti.com>


Applied.
diff mbox series

Patch

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,