Re: [PATCH] usb: storage: ene_ub6250: set transport_reset to avoid NULL deref

From: Alan Stern

Date: Wed Sep 09 2026 - 13:08:49 EST


On Wed, Sep 09, 2026 at 11:27:10PM +0700, Nguyen Ngoc Thang wrote:
> ene_ub6250_probe() sets us->transport but never sets
> us->transport_reset. get_transport() only fills in transport_reset
> for the standard USB_PR_CB/CBI/BULK protocols; since this driver
> matches on VID/PID alone, a device can report any bInterfaceProtocol
> value and still bind, leaving transport_reset NULL.
>
> When the transport then reports an error, usb_stor_invoke_transport()
> calls us->transport_reset(us) in its Handle_Errors path, dereferencing
> a NULL function pointer:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000000
> RIP: 0010:0x0
> Call Trace:
> usb_stor_invoke_transport+0x55a/0x1a40 drivers/usb/storage/transport.c:926
> usb_stor_control_thread+0x44c/0x8f0 drivers/usb/storage/usb.c:462
> kthread+0x38b/0x480 kernel/kthread.c:436
>
> Set transport_reset to usb_stor_Bulk_reset, matching the same pattern
> already used by the other subdrivers with a custom transport function
> (alauda, datafab, jumpshot, karma).
>
> Reported-by: syzbot+356ae236154297f0d60d@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzkaller.appspot.com/bug?extid=356ae236154297f0d60d
> Signed-off-by: Nguyen Ngoc Thang <ngocthang2710.1999@xxxxxxxxx>
> ---

Is there any reason to think that usb_stor_Bulk_reset is appropriate for
the ene_ub6250?

Probably a better solution would be either to make usb_stor_probe2()
check that us->transport_reset isn't NULL, or even better, make
scsiglue.c:device_reset() fail immediately if us->transport_reset is
NULL. Either one of these would work if some other subdriver forgets to
set transport_reset.

Alan Stern

> drivers/usb/storage/ene_ub6250.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
> index ed49a3bc859c..3137c2cdd021 100644
> --- a/drivers/usb/storage/ene_ub6250.c
> +++ b/drivers/usb/storage/ene_ub6250.c
> @@ -2350,6 +2350,8 @@ static int ene_ub6250_probe(struct usb_interface *intf,
>
> us->transport_name = "ene_ub6250";
> us->transport = ene_transport;
> + /* get_transport() only sets this for the standard USB_PR_* protocols */
> + us->transport_reset = usb_stor_Bulk_reset;
> us->max_lun = 0;
>
> result = usb_stor_probe2(us);
> --
> 2.43.0
>