From: Greg KH <gregkh@linuxfoundation.org>
To: Chengfeng Ye <dg573847474@gmail.com>
Cc: gustavoars@kernel.org, u.kleine-koenig@pengutronix.de,
giometti@linux.it, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: host: oxu210hp-hcd: Fix potential deadlock on &oxu->mem_lock
Date: Tue, 8 Aug 2023 10:28:14 +0200 [thread overview]
Message-ID: <2023080817-antler-enchilada-cccf@gregkh> (raw)
In-Reply-To: <20230729092634.78336-1-dg573847474@gmail.com>
On Sat, Jul 29, 2023 at 09:26:34AM +0000, Chengfeng Ye wrote:
> &oxu->mem_lock is acquired by isr oxu_irq() along the below call
> chain under hardirq context.
>
> <hard interrupt>
> -> oxu_irq()
> -> oxu210_hcd_irq()
> -> ehci_work()
> -> scan_async()
> -> qh_completions()
> -> oxu_murb_free()
> -> spin_lock(&oxu->mem_lock)
>
> Thus the acquisition of the lock under process context should disable
> irq, otherwise deadlock could happen if the irq happens to preempt the
> execution while the lock is held in process context on the same CPU.
>
> This flaw was found by an experimental static analysis tool I am developing
> for irq-related deadlock. x86_64 allmodconfig using gcc shows no new
> warning.
>
> The patch fixes the potential deadlocks by using spin_lock_irqsave() on
> &oxu->mem_lock
>
> Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
>
> Changes in v2
> - use spin_lock_irqsave() on more potential deadlock sites of &oxu->mem_lock
This needs to be below the --- line, as documented, so it doesn't show
up in the changelog.
How did you test this change? Do you have hardware to test it out? If
not, I don't think we can accpet this, see the kernel documentation for
what we accept from tools and researchers.
thanks,
greg k-h
next prev parent reply other threads:[~2023-08-08 20:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-29 9:26 [PATCH v2] usb: host: oxu210hp-hcd: Fix potential deadlock on &oxu->mem_lock Chengfeng Ye
2023-08-08 8:28 ` Greg KH [this message]
2023-08-08 15:17 ` Chengfeng Ye
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=2023080817-antler-enchilada-cccf@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dg573847474@gmail.com \
--cc=giometti@linux.it \
--cc=gustavoars@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.