]> git.baikalelectronics.ru Git - kernel.git/commit
net: hsr: fix mac_len checks
authorGeorge McCollister <george.mccollister@gmail.com>
Mon, 24 May 2021 18:50:54 +0000 (13:50 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 May 2021 21:10:28 +0000 (14:10 -0700)
commit9662b7af2c0ad85e67d07dcd954d9638c20f6579
tree26ea4fa3badf5fbf8bd12d290a8c81a75250a25e
parent704be12d95ed7d41d19aaba37357e5ea80e3c5de
net: hsr: fix mac_len checks

Commit acde5a9ed9ba ("net: hsr: check skb can contain struct hsr_ethhdr
in fill_frame_info") added the following which resulted in -EINVAL
always being returned:
if (skb->mac_len < sizeof(struct hsr_ethhdr))
return -EINVAL;

mac_len was not being set correctly so this check completely broke
HSR/PRP since it was always 14, not 20.

Set mac_len correctly and modify the mac_len checks to test in the
correct places since sometimes it is legitimately 14.

Fixes: acde5a9ed9ba ("net: hsr: check skb can contain struct hsr_ethhdr in fill_frame_info")
Signed-off-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/hsr/hsr_device.c
net/hsr/hsr_forward.c
net/hsr/hsr_forward.h
net/hsr/hsr_main.h
net/hsr/hsr_slave.c