From: Alexander Aring Date: Fri, 17 Feb 2023 04:25:04 +0000 (-0500) Subject: ca8210: fix mac_len negative array access X-Git-Tag: baikal/mips/sdk5.8.2~73 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=32eeaa6e5a4c007973bf58903d7d79a79a6a1e45;p=kernel.git ca8210: fix mac_len negative array access [ Upstream commit 6c993779ea1d0cccdb3a5d7d45446dd229e610a3 ] This patch fixes a buffer overflow access of skb->data if ieee802154_hdr_peek_addrs() fails. Reported-by: lianhui tang Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20230217042504.3303396-1-aahringo@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin --- diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c index 66cf09e637e4e..498a82ab4eaf4 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -1955,6 +1955,8 @@ static int ca8210_skb_tx( * packet */ mac_len = ieee802154_hdr_peek_addrs(skb, &header); + if (mac_len < 0) + return mac_len; secspec.security_level = header.sec.level; secspec.key_id_mode = header.sec.key_id_mode;