[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241029211426.3046219-1-Randy.MacLeod@windriver.com>
Date: Tue, 29 Oct 2024 17:14:26 -0400
From: <Randy.MacLeod@...driver.com>
To: <sherry.yang@...cle.com>
CC: <bridge@...ts.linux-foundation.org>, <davem@...emloft.net>,
<gregkh@...uxfoundation.org>, <kuba@...nel.org>,
<netdev@...r.kernel.org>, <nikolay@...dia.com>, <roopa@...dia.com>,
<sashal@...nel.org>, <stable@...r.kernel.org>,
<randy.macleod@...driver.com>
Subject: [PATCH 5.15.y] net: bridge: xmit: make sure we have at least eth header len bytes
From: Randy MacLeod <Randy.MacLeod@...driver.com>
[ Upstream commit 8bd67ebb50c0145fd2ca8681ab65eb7e8cde1afc ]
Based on above commit but simplified since pskb_may_pull_reason()
does not exist until 6.1.
syzbot triggered an uninit value[1] error in bridge device's xmit path
by sending a short (less than ETH_HLEN bytes) skb. To fix it check if
we can actually pull that amount instead of assuming.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: syzbot+a63a1f6a062033cf0f40@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a63a1f6a062033cf0f40
Signed-off-by: Randy MacLeod <Randy.MacLeod@...driver.com>
---
net/bridge/br_device.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 8d6bab244c4a..b2fa4ca28102 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -38,6 +38,11 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
const unsigned char *dest;
u16 vid = 0;
+ if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) {
+ kfree_skb(skb);
+ return NETDEV_TX_OK;
+ }
+
memset(skb->cb, 0, sizeof(struct br_input_skb_cb));
rcu_read_lock();
--
2.34.1
Powered by blists - more mailing lists