Browse Source

net: hsr/prp: validate address B before copying to skb

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

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Murali Karicheri 6 years ago
parent
commit
7afaf8c58f
1 changed files with 4 additions and 1 deletions
  1. 4 1
      net/hsr-prp/hsr_prp_framereg.c

+ 4 - 1
net/hsr-prp/hsr_prp_framereg.c

@@ -318,7 +318,10 @@ void hsr_prp_addr_subst_dest(struct hsr_prp_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_prp_register_frame_in(struct hsr_prp_node *node,