Skip to contentSkip to conversation

ca8210: fix mac_len negative array access

PATCH In review Alexander Aring 2 participants 2 messages Feb 17, 2023 – Feb 18, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ca8210: fix mac_len negative array access

This patch fixes a buffer overflow access of skb->data if ieee802154_hdr_peek_addrs() fails.

---
 drivers/net/ieee802154/ca8210.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ieee802154/ca8210.c +2 -0
index e1a569b99e4a..0b0c6c0764fe 100644
@@ -1913,6 +1913,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;
Signature · 1 line
2.31.1
maintainer
#1 lore raw

Hello.

Quoted 14 lines · Alexander Aring

This patch fixes a buffer overflow access of skb->data if ieee802154_hdr_peek_addrs() fails.

---
  drivers/net/ieee802154/ca8210.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/net/ieee802154/ca8210.c +0 -0
index e1a569b99e4a..0b0c6c0764fe 100644

drivers/net/ieee802154/ca8210.c static int ca8210_skb_tx( · line 1920

Quoted 8 lines
drivers/net/ieee802154/ca8210.c +2 -0
@@ -1913,6 +1913,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;

This patch has been applied to the wpan tree and will be part of the next pull request to net. Thanks!

regards
Stefan Schmidt