Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb-storage: ene_ub6250: serialize card type probe with scan work
@ 2026-08-21  5:53 liuqi
  2026-08-21  5:58 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: liuqi @ 2026-08-21  5:53 UTC (permalink / raw)
  To: gregkh; +Cc: liuqi, linux-usb, stable, syzbot+22ea20ef3afb6785b122

usb_stor_probe2() starts the usb-storage infrastructure and schedules
the delayed scan work. The probe then calls ene_get_card_type(), which
sends a command through ene_send_scsi_cmd() and the usb-storage bulk
transfer helpers. These helpers use us->current_urb.

The delayed scan work also uses us->current_urb when issuing GET_MAX_LUN
through usb_stor_Bulk_max_lun(). The scan path is serialized with
us->dev_mutex, but the post-usb_stor_probe2() ENE card-type probe is not.

If the ENE card-type command is still in flight when the delayed scan
work runs, the scan work can try to submit the same URB again, and
usb_submit_urb() warns that the URB is already active.

Serialize ene_get_card_type() with us->dev_mutex, matching the locking
used by the scan path.

Reported-by: syzbot+22ea20ef3afb6785b122@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=22ea20ef3afb6785b122
Signed-off-by: liuqi <liuqi@longcheer.com>
---
 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 2cffc559a..13b332d1d 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -2358,7 +2358,9 @@ static int ene_ub6250_probe(struct usb_interface *intf,
 		return result;
 
 	/* probe card type */
+	mutex_lock(&us->dev_mutex);
 	result = ene_get_card_type(us, REG_CARD_STATUS, info->bbuf);
+	mutex_unlock(&us->dev_mutex);
 	if (result != USB_STOR_XFER_GOOD) {
 		usb_stor_disconnect(intf);
 		return USB_STOR_TRANSPORT_ERROR;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb-storage: ene_ub6250: serialize card type probe with scan work
  2026-08-21  5:53 [PATCH] usb-storage: ene_ub6250: serialize card type probe with scan work liuqi
@ 2026-08-21  5:58 ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-08-21  5:58 UTC (permalink / raw)
  To: liuqi; +Cc: linux-usb, stable, syzbot+22ea20ef3afb6785b122

On Fri, Aug 21, 2026 at 01:53:58PM +0800, liuqi wrote:
> usb_stor_probe2() starts the usb-storage infrastructure and schedules
> the delayed scan work. The probe then calls ene_get_card_type(), which
> sends a command through ene_send_scsi_cmd() and the usb-storage bulk
> transfer helpers. These helpers use us->current_urb.
> 
> The delayed scan work also uses us->current_urb when issuing GET_MAX_LUN
> through usb_stor_Bulk_max_lun(). The scan path is serialized with
> us->dev_mutex, but the post-usb_stor_probe2() ENE card-type probe is not.
> 
> If the ENE card-type command is still in flight when the delayed scan
> work runs, the scan work can try to submit the same URB again, and
> usb_submit_urb() warns that the URB is already active.
> 
> Serialize ene_get_card_type() with us->dev_mutex, matching the locking
> used by the scan path.
> 
> Reported-by: syzbot+22ea20ef3afb6785b122@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=22ea20ef3afb6785b122
> Signed-off-by: liuqi <liuqi@longcheer.com>

Did you forget an Assisted-by: tag for this?

How was this tested?

And as before, we need a real name.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb-storage: ene_ub6250: serialize card type probe with scan work
@ 2026-08-21  7:33 liuqi
  0 siblings, 0 replies; 4+ messages in thread
From: liuqi @ 2026-08-21  7:33 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, syzbot+22ea20ef3afb6785b122, Liu Qi

From: Liu Qi <liuqi@longcheer.com>

Hi Greg,

Yes, I missed the Assisted-by tag. I have added it in v2.
I also updated the author and Signed-off-by lines to use my real name,
Liu Qi.
For testing, I asked syzbot to test the patch, but syzbot replied that
this crash does not have a reproducer and cannot be tested. So I did not
add a syzbot Tested-by tag.
I have sent v2 with these updates.
Thanks,
Liu Qi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb-storage: ene_ub6250: serialize card type probe with scan work
@ 2026-08-21  7:39 liuqi
  0 siblings, 0 replies; 4+ messages in thread
From: liuqi @ 2026-08-21  7:39 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, syzbot+22ea20ef3afb6785b122, Liu Qi

From: Liu Qi <liuqi@longcheer.com>

Hi Greg,

I apologize for the incorrect patch in my previous reply. The v2
patch with the correct Subject, changelog, and tags was not attached.
Here is the corrected patch v2 with:

- Assisted-by: Qwen:Qwen3.6
- Signed-off-by: Liu Qi <liuqi@longcheer.com>
- Reported-by: syzbot+22ea20ef3afb6785b122@syzkaller.appspotmail.com
- Closes: https://syzkaller.appspot.com/bug?extid=22ea20ef3afb6785b122
- Testing note

Please find the corrected patch attached.
Thanks,
Liu Qi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-21  7:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21  5:53 [PATCH] usb-storage: ene_ub6250: serialize card type probe with scan work liuqi
2026-08-21  5:58 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2026-08-21  7:33 liuqi
2026-08-21  7:39 liuqi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox