From: Ping-Ke Shih <pkshih@realtek.com>
To: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH rtw-next] wifi: rtw89: usb: Avoid crash with dynamically added device ID
Date: Mon, 17 Aug 2026 03:38:32 +0000 [thread overview]
Message-ID: <84fa3f2903224073a3c5a9514d3f082a@realtek.com> (raw)
In-Reply-To: <eb6870f7-79f0-4fa8-9148-5e48366d6672@gmail.com>
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> Adding a device ID via sysfs causes a crash when the device is plugged
> in, because the driver_info pointer is null.
I don't know about this before. Does it looks like?
echo "1234 5678" | sudo tee /sys/bus/usb/drivers/my_driver/new_id
>
> Add a wrapper around rtw89_usb_probe() in each driver to check if
> driver_info is null and provide a reasonable default value for it.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
I'd give my acked-by in advance. But you still can consider my opinion below.
> ---
> The PCI side has the same problem, but new device IDs are a lot less
> likely there.
Thanks for the info.
[...]
> +static int rtw8851bu_probe(struct usb_interface *intf,
> + const struct usb_device_id *id)
> +{
> + const struct rtw89_driver_info *info;
> +
> + if (id->driver_info)
> + info = (const struct rtw89_driver_info *)id->driver_info;
> + else
> + info = &rtw89_8851bu_info;
> +
> + return rtw89_usb_probe(intf, info);
> +}
> +
If you want to simply specific probe(), here might be
static int rtw8851bu_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
return rtw89_usb_probe(intf, id, &rtw89_8851bu_info);
}
Then
int rtw89_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id,
const struct rtw89_driver_info *default_info)
{
...
info = (const struct rtw89_driver_info *)id->driver_info;
if (!info)
info = default_info;
}
prev parent reply other threads:[~2026-08-17 3:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-16 18:20 [PATCH rtw-next] wifi: rtw89: usb: Avoid crash with dynamically added device ID Bitterblue Smith
2026-08-17 3:38 ` Ping-Ke Shih [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=84fa3f2903224073a3c5a9514d3f082a@realtek.com \
--to=pkshih@realtek.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rtl8821cerfe2@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.