From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>,
kuba@kernel.org, pabeni@redhat.com, bigeasy@linutronix.de,
imagedong@tencent.com, petrm@nvidia.com, memxor@gmail.com,
arnd@arndb.de, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 17/29] net: remove two BUG() from skb_checksum_help()
Date: Mon, 30 May 2022 09:50:44 -0400 [thread overview]
Message-ID: <20220530135057.1937286-17-sashal@kernel.org> (raw)
In-Reply-To: <20220530135057.1937286-1-sashal@kernel.org>
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit d7ea0d9df2a6265b2b180d17ebc64b38105968fc ]
I have a syzbot report that managed to get a crash in skb_checksum_help()
If syzbot can trigger these BUG(), it makes sense to replace
them with more friendly WARN_ON_ONCE() since skb_checksum_help()
can instead return an error code.
Note that syzbot will still crash there, until real bug is fixed.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/dev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index ea09e0809c12..d99dce0efedc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2641,11 +2641,15 @@ int skb_checksum_help(struct sk_buff *skb)
}
offset = skb_checksum_start_offset(skb);
- BUG_ON(offset >= skb_headlen(skb));
+ ret = -EINVAL;
+ if (WARN_ON_ONCE(offset >= skb_headlen(skb)))
+ goto out;
+
csum = skb_checksum(skb, offset, skb->len - offset, 0);
offset += skb->csum_offset;
- BUG_ON(offset + sizeof(__sum16) > skb_headlen(skb));
+ if (WARN_ON_ONCE(offset + sizeof(__sum16) > skb_headlen(skb)))
+ goto out;
if (skb_cloned(skb) &&
!skb_clone_writable(skb, offset + sizeof(__sum16))) {
--
2.35.1
next prev parent reply other threads:[~2022-05-30 14:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220530135057.1937286-1-sashal@kernel.org>
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 02/29] mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue Sasha Levin
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 03/29] b43legacy: Fix assigning negative value to unsigned variable Sasha Levin
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 04/29] b43: " Sasha Levin
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 05/29] ipw2x00: Fix potential NULL dereference in libipw_xmit() Sasha Levin
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 09/29] ath9k: fix QCA9561 PA bias level Sasha Levin
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 15/29] ipv6: Don't send rs packets to the interface of ARPHRD_TUNNEL Sasha Levin
2022-05-30 13:50 ` Sasha Levin [this message]
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 21/29] rtlwifi: Use pr_warn instead of WARN_ONCE Sasha Levin
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 25/29] net: phy: micrel: Allow probing without .driver_data Sasha Levin
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 28/29] rxrpc: Return an error to sendmsg if call failed Sasha Levin
2022-05-30 13:50 ` [PATCH AUTOSEL 4.14 29/29] eth: tg3: silence the GCC 12 array-bounds warning Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220530135057.1937286-17-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=arnd@arndb.de \
--cc=bigeasy@linutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=imagedong@tencent.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).