From: Greg KH <gregkh@linuxfoundation.org>
To: Matt Lee <matt@oscium.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 2/2] USB: max3421: Fix scheduling while atomic in max3421_remove()
Date: Mon, 10 Feb 2025 15:07:02 +0100 [thread overview]
Message-ID: <2025021044-conjuror-captivity-619b@gregkh> (raw)
In-Reply-To: <CABrMTje0ijdtcO31HmuSufxXFQO2Ay2Rh0_0Qc4FFC3zgqe-pA@mail.gmail.com>
On Mon, Feb 10, 2025 at 07:48:29AM -0600, Matt Lee wrote:
> A bug in `max3421_remove()` caused a "scheduling while atomic" crash when
> `kthread_stop()` was called while holding a spinlock.
>
> This patch ensures that `kthread_stop()` is called outside the spinlock,
> fixing the crash and improving system stability when unloading the driver.
>
> Signed-off-by: Matt Lee <matt@oscium.com>
> ---
> drivers/usb/host/max3421-hcd.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
> index abcdef0..1234567 100644
> --- a/drivers/usb/host/max3421-hcd.c
> +++ b/drivers/usb/host/max3421-hcd.c
> @@ -1936,11 +1945,10 @@ max3421_remove(struct spi_device *spi)
> usb_remove_hcd(hcd);
>
> spin_lock_irqsave(&max3421_hcd->lock, flags);
> + spin_unlock_irqrestore(&max3421_hcd->lock, flags);
>
> kthread_stop(max3421_hcd->spi_thread);
>
> - spin_unlock_irqrestore(&max3421_hcd->lock, flags);
> -
So now the lock does nothing? Are you sure this change is correct?
thanks,
greg k-h
next parent reply other threads:[~2025-02-10 14:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CABrMTje0ijdtcO31HmuSufxXFQO2Ay2Rh0_0Qc4FFC3zgqe-pA@mail.gmail.com>
2025-02-10 14:07 ` Greg KH [this message]
2025-02-10 15:42 ` [PATCH 2/2] USB: max3421: Fix scheduling while atomic in max3421_remove() Matt Lee
2025-02-10 15:51 ` Greg KH
2025-02-10 14:06 Matt Lee
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=2025021044-conjuror-captivity-619b@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=matt@oscium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox