Skip to content

Commit

Permalink
net: hsr: validate address B before copying to skb
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Murali Karicheri authored and David S. Miller committed Jul 18, 2020
1 parent 6d6148b commit eea9f73
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/hsr/hsr_framereg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit eea9f73

Please sign in to comment.