From: syzbot <syzbot+e84ecca6d1fa09a9b3d9@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: Re: [PATCH RFC] wifi: rt2x00usb: fix NULL pointer dereference in rt2x00usb_disconnect()
Date: Tue, 19 May 2026 07:24:19 -0700 [thread overview]
Message-ID: <6a0c7293.170a0220.3cbd30.0136.GAE@google.com> (raw)
In-Reply-To: <671906e2.050a0220.1e4b4d.008d.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [PATCH RFC] wifi: rt2x00usb: fix NULL pointer dereference in rt2x00usb_disconnect()
Author: nogikh@google.com
#syz reject
Syzbot apparently got confused by NULLs in the strace output.
On Sat, May 16, 2026 at 8:22 PM 'syzbot' via
syzkaller-upstream-moderation
<syzkaller-upstream-moderation@googlegroups.com> wrote:
>
> In `rt2x00usb_probe()`, `usb_reset_device()` is called early. If this
> reset fails or detects an unexpected device state (which is common with
> malicious or rapidly disconnecting simulated USB devices), the USB core
> schedules an asynchronous logical disconnect for the device. If the
> probe function subsequently fails (e.g., due to hardware allocation or
> registration failure), it cleans up by freeing the hardware struct and
> setting the interface data to NULL via `usb_set_intfdata(usb_intf,
> NULL)`.
>
> Due to a race condition with the asynchronous disconnect scheduled by
> the early reset, the `rt2x00usb_disconnect()` callback can be invoked
> even after the probe has failed and cleared the interface data. When
> `rt2x00usb_disconnect()` is called, it fetches the interface data using
> `usb_get_intfdata()` and unconditionally dereferences it to access
> `hw->priv`, leading to a kernel panic since `hw` is NULL.
>
> Fix this by adding a NULL check for `hw` at the beginning of
> `rt2x00usb_disconnect()`. If `hw` is NULL, it means the probe failed and
> the cleanup has already been performed, so the function can safely
> return early.
>
> Fixes: bf4c02d5e772903be5bf8952bac730a2956d0619 ("rt2x00: reset usb devices at probe")
> Assisted-by: Gemini:gemini-3.1-pro-preview Gemini:gemini-3-flash-preview
> Reported-by: syzbot+e84ecca6d1fa09a9b3d9@syzkaller.appspotmail.com
> Link: https://syzkaller.appspot.com/bug?extid=e84ecca6d1fa09a9b3d9
> Link: https://syzkaller.appspot.com/ai_job?id=63946763-bd49-4c8e-b059-d7248e547b72
> To: <linux-wireless@vger.kernel.org>
> To: <stf_xl@wp.pl>
> Cc: <linux-kernel@vger.kernel.org>
>
> ---
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> index 174d89b0b..ea6ceb3a1 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
> @@ -858,7 +858,12 @@ EXPORT_SYMBOL_GPL(rt2x00usb_probe);
> void rt2x00usb_disconnect(struct usb_interface *usb_intf)
> {
> struct ieee80211_hw *hw = usb_get_intfdata(usb_intf);
> - struct rt2x00_dev *rt2x00dev = hw->priv;
> + struct rt2x00_dev *rt2x00dev;
> +
> + if (!hw)
> + return;
> +
> + rt2x00dev = hw->priv;
>
> /*
> * Free all allocated data.
>
>
> base-commit: 5d6919055dec134de3c40167a490f33c74c12581
> --
> This is an AI-generated patch subject to moderation.
> Reply with '#syz upstream' to send it to the mailing list.
> Reply with '#syz reject' to reject it.
>
> See for more information.
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-upstream-moderation" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-upstream-moderation+unsubscribe@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/syzkaller-upstream-moderation/f98a17ac-9a06-46f2-af52-ba19ff0ead38%40mail.kernel.org.
--
You received this message because you are subscribed to the Google Groups "syzkaller-upstream-moderation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-upstream-moderation+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/syzkaller-upstream-moderation/CANp29Y6a2q%2Bbn6zL1%2BR5Vac8Wa3tNX682WQB1s-aYAmyHS8syg%40mail.gmail.com.
prev parent reply other threads:[~2026-05-19 14:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 14:23 [syzbot] [wireless?] WARNING: ODEBUG bug in ieee80211_led_exit (2) syzbot
2025-02-06 15:20 ` syzbot
2026-05-19 14:24 ` syzbot [this message]
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=6a0c7293.170a0220.3cbd30.0136.GAE@google.com \
--to=syzbot+e84ecca6d1fa09a9b3d9@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/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
all inboxes | Powered by JetHome®