Linux kernel -stable discussions
 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; 2+ 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] 2+ messages in thread

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

Thread overview: 2+ 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

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