From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Toke Høiland-Jørgensen" <toke@redhat.com>,
syzbot+98afa303be379af6cdb2@syzkaller.appspotmail.com,
"Kalle Valo" <quic_kvalo@quicinc.com>,
"Sasha Levin" <sashal@kernel.org>,
toke@toke.dk, kvalo@kernel.org, linux-wireless@vger.kernel.org
Subject: [PATCH AUTOSEL 6.6 003/139] wifi: ath9k_htc: Use __skb_set_length() for resetting urb before resubmit
Date: Wed, 25 Sep 2024 08:07:03 -0400 [thread overview]
Message-ID: <20240925121137.1307574-3-sashal@kernel.org> (raw)
In-Reply-To: <20240925121137.1307574-1-sashal@kernel.org>
From: Toke Høiland-Jørgensen <toke@redhat.com>
[ Upstream commit 94745807f3ebd379f23865e6dab196f220664179 ]
Syzbot points out that skb_trim() has a sanity check on the existing length of
the skb, which can be uninitialised in some error paths. The intent here is
clearly just to reset the length to zero before resubmitting, so switch to
calling __skb_set_length(skb, 0) directly. In addition, __skb_set_length()
already contains a call to skb_reset_tail_pointer(), so remove the redundant
call.
The syzbot report came from ath9k_hif_usb_reg_in_cb(), but there's a similar
usage of skb_trim() in ath9k_hif_usb_rx_cb(), change both while we're at it.
Reported-by: syzbot+98afa303be379af6cdb2@syzkaller.appspotmail.com
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20240812142447.12328-1-toke@toke.dk
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath9k/hif_usb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index e5414435b1414..ab728a70ed279 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -716,8 +716,7 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb)
}
resubmit:
- skb_reset_tail_pointer(skb);
- skb_trim(skb, 0);
+ __skb_set_length(skb, 0);
usb_anchor_urb(urb, &hif_dev->rx_submitted);
ret = usb_submit_urb(urb, GFP_ATOMIC);
@@ -754,8 +753,7 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
case -ESHUTDOWN:
goto free_skb;
default:
- skb_reset_tail_pointer(skb);
- skb_trim(skb, 0);
+ __skb_set_length(skb, 0);
goto resubmit;
}
--
2.43.0
next prev parent reply other threads:[~2024-09-25 12:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 12:07 [PATCH AUTOSEL 6.6 001/139] wifi: ath9k: fix possible integer overflow in ath9k_get_et_stats() Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 002/139] wifi: rtw89: avoid to add interface to list twice when SER Sasha Levin
2024-09-25 12:07 ` Sasha Levin [this message]
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 008/139] wifi: iwlwifi: mvm: Fix a race in scan abort flow Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 009/139] wifi: iwlwifi: mvm: drop wrong STA selection in TX Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 010/139] wifi: cfg80211: Set correct chandef when starting CAC Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 019/139] wifi: mt76: mt7915: disable tx worker during tx BA session enable/disable Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 027/139] wifi: ath12k: fix array out-of-bound access in SoC stats Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 028/139] wifi: ath11k: " Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 029/139] wifi: rtw88: select WANT_DEV_COREDUMP Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 037/139] wifi: rtw89: correct base HT rate mask for firmware Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 044/139] wifi: iwlwifi: mvm: use correct key iteration Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 045/139] wifi: iwlwifi: mvm: avoid NULL pointer dereference Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 046/139] wifi: mac80211: fix RCU list iterations Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 052/139] wifi: mt76: mt7915: add dummy HW offload of IEEE 802.11 fragmentation Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 053/139] wifi: mt76: mt7915: hold dev->mt76.mutex while disabling tx worker Sasha Levin
2024-09-25 12:07 ` [PATCH AUTOSEL 6.6 055/139] wifi: mwifiex: Fix memcpy() field-spanning write warning in mwifiex_cmd_802_11_scan_ext() Sasha Levin
2024-10-05 8:57 ` [PATCH AUTOSEL 6.6 001/139] wifi: ath9k: fix possible integer overflow in ath9k_get_et_stats() Pavel Machek
2024-10-05 9:06 ` Greg KH
2024-10-05 12:03 ` Pavel Machek
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=20240925121137.1307574-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_kvalo@quicinc.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+98afa303be379af6cdb2@syzkaller.appspotmail.com \
--cc=toke@redhat.com \
--cc=toke@toke.dk \
/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).