Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiayi Li" <lijiayi@kylinos.cn>
Cc: linux-usb@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] usb: uas: wait for pending commands before unbinding
Date: Thu, 22 Oct 2026 12:48:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-181504@kernel.org> (raw)
In-Reply-To: <20261022123401.319479-1-lijiayi@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] usb: uas: pass &shost->host_lock pointer in uas_pre_disconnect()
--

commit 8e251b22758d30ff0f9e6d2743bdddf6dd61fc28
Author: Jiayi Li <lijiayi@kylinos.cn>

usb: uas: wait for pending commands before unbinding

This commit enables soft_unbind on the uas driver and introduces
uas_pre_disconnect() to block new SCSI requests and wait for pending
commands and URBs to complete before unbinding.

> diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
> index 8655edbd66b16..4ece8f15bd170 100644
> --- a/drivers/usb/storage/uas.c
> +++ b/drivers/usb/storage/uas.c

[ ... ]

> @@ -1211,16 +1212,55 @@ static int uas_reset_resume(struct usb_interface *intf)
>  	return 0;
>  }
>  
> +static void uas_pre_disconnect(struct usb_interface *intf)
> +{
> +	struct Scsi_Host *shost = usb_get_intfdata(intf);
> +	struct uas_dev_info *devinfo = (struct uas_dev_info *)shost->hostdata;
> +	unsigned long flags, start_time;
> +
> +	spin_lock_irqsave(shost->host_lock, flags);
> +	scsi_block_requests(shost);
> +	spin_unlock_irqrestore(shost->host_lock, flags);

[Severity: Low]
In uas_pre_disconnect() in drivers/usb/storage/uas.c, shost->host_lock is
passed by value to spin_lock_irqsave() and spin_unlock_irqrestore(), which
causes a build failure when CONFIG_USB_UAS is enabled.

In struct Scsi_Host (include/scsi/scsi_host.h), host_lock is an embedded
spinlock_t rather than a pointer (changed in commit e83b47309f73 ("scsi:
core: Drop Scsi_Host.default_lock")):

    struct Scsi_Host {
        ...
        spinlock_t		host_lock;

Other callers in drivers/usb/storage/uas.c, such as uas_reset_resume(), pass
&shost->host_lock:

    spin_lock_irqsave(&shost->host_lock, flags);
    scsi_report_bus_reset(shost, 0);
    spin_unlock_irqrestore(&shost->host_lock, flags);

Should uas_pre_disconnect() pass &shost->host_lock here as well?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261022123401.319479-1-lijiayi@kylinos.cn?part=1

  reply	other threads:[~2026-10-22 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 12:34 [PATCH] usb: uas: wait for pending commands before unbinding Jiayi Li
2026-10-22 12:48 ` sashiko-bot [this message]
2026-10-22 13:05 ` Greg Kroah-Hartman
2026-10-22 13:29 ` Oliver Neukum
2026-10-23  1:48   ` Jiayi Li

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=sashiko-outbox-181504@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lijiayi@kylinos.cn \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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