net: hsr: check skb can contain struct hsr_ethhdr in fill_frame_info
authorPhillip Potter <phil@philpotter.co.uk>
Sun, 2 May 2021 21:34:42 +0000 (22:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 09:40:54 +0000 (11:40 +0200)
commit86587f35cba979c2d55376d08a9d553d846e84a5
tree8fb1eac345109bb86ae21c6d3f597a452ea6f3dc
parent82646b1844a21473129c5e8c381a087e1f59a22a
net: hsr: check skb can contain struct hsr_ethhdr in fill_frame_info

[ Upstream commit 2e9f60932a2c19e8a11b4a69d419f107024b05a0 ]

Check at start of fill_frame_info that the MAC header in the supplied
skb is large enough to fit a struct hsr_ethhdr, as otherwise this is
not a valid HSR frame. If it is too small, return an error which will
then cause the callers to clean up the skb. Fixes a KMSAN-found
uninit-value bug reported by syzbot at:
https://syzkaller.appspot.com/bug?id=f7e9b601f1414f814f7602a82b6619a8d80bce3f

Reported-by: syzbot+e267bed19bfc5478fb33@syzkaller.appspotmail.com
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/hsr/hsr_forward.c