summaryrefslogtreecommitdiff
path: root/net/hsr/hsr_framereg.c
diff options
context:
space:
mode:
authorMurali Karicheri <m-karicheri2@ti.com>2020-07-17 17:55:10 +0300
committerDavid S. Miller <davem@davemloft.net>2020-07-18 04:54:37 +0300
commiteea9f73e1ff9b99fbb937d41bb07c5bb2ae9ea2f (patch)
treeb5fa023619bb3a17ba4b78e53582c0f4f75e1ab1 /net/hsr/hsr_framereg.c
parent6d6148bc78d2f002ecc67b801c5f55a0cc5184c8 (diff)
downloadlinux-eea9f73e1ff9b99fbb937d41bb07c5bb2ae9ea2f.tar.xz
net: hsr: validate address B before copying to skb
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>
Diffstat (limited to 'net/hsr/hsr_framereg.c')
-rw-r--r--net/hsr/hsr_framereg.c3
1 files changed, 2 insertions, 1 deletions
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,