From: Jakub Kicinski <kuba@kernel.org>
To: omermetekaya0@gmail.com
Cc: netdev@vger.kernel.org, oneukum@suse.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] usbnet: fix EVENT_RX_PAUSED race in usbnet_skb_return()
Date: Fri, 16 Oct 2026 15:58:25 -0700 [thread overview]
Message-ID: <20261016155825.17d29015@kernel.org> (raw)
In-Reply-To: <179175615306.434549.2652185067157444525@kernel.org>
On Sun, 11 Oct 2026 22:02:33 +0000 netdev-bot+sashiko@kernel.org wrote:
> Will lockdep complain now that this lock is taken with hardirqs enabled?
>
> Before this patch, rxq_pause.lock was only taken through skb_queue_tail()
> and skb_dequeue(). Both use spin_lock_irqsave(). Here the lock is taken
> with spin_lock_bh(). usbnet_resume_rx() below takes it with plain
> spin_lock() inside local_bh_disable().
>
> usbnet_probe() initializes all four queues with the same inline helper,
> so they appear to share one lockdep class:
>
> usbnet_probe() {
> ...
> skb_queue_head_init (&dev->rxq);
> skb_queue_head_init (&dev->txq);
> skb_queue_head_init (&dev->done);
> skb_queue_head_init(&dev->rxq_pause);
> ...
> }
>
> defer_bh() relies on this too. It uses spin_lock_nested() for
> dev->done.lock while it holds rxq.lock or txq.lock.
>
> Some host controllers do not set HCD_BH (OHCI, UHCI, musb and others).
> On those, usb_hcd_giveback_urb() runs the completion directly from the
> HCD interrupt handler, so rx_complete()->defer_bh() takes that lock class
> in hardirq:
>
> defer_bh() {
> spin_lock_irqsave(&list->lock, flags);
> ...
> spin_lock_nested(&dev->done.lock, SINGLE_DEPTH_NESTING);
> ...
> }
>
> With CONFIG_PROVE_LOCKING, wouldn't the first qualifying MTU increase
> through usbnet_change_mtu()->usbnet_resume_rx() then trigger an
> "inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage" report and turn
> lockdep off?
>
> No code takes rxq_pause.lock itself from hardirq today, so no real
> deadlock is known. Using spin_lock_irqsave()/spin_unlock_irqrestore() in
> both new critical sections would match every other sk_buff_head lock use
> in usbnet.c.
Good suggestion.
prev parent reply other threads:[~2026-10-16 22:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 22:01 [PATCH net v3] usbnet: fix EVENT_RX_PAUSED race in usbnet_skb_return() Ömer Mete Kaya
2026-10-07 22:09 ` netdev-bot+sinfo
2026-10-08 15:40 ` Jakub Kicinski
2026-10-08 15:47 ` Ömer Mete Kaya
2026-10-08 18:03 ` Jakub Kicinski
2026-10-08 15:42 ` Ömer Mete Kaya
2026-10-08 22:03 ` sashiko-bot
2026-10-09 15:48 ` Ömer Mete Kaya
2026-10-11 22:02 ` netdev-bot+sashiko
2026-10-16 22:58 ` Jakub Kicinski [this message]
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=20261016155825.17d29015@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=omermetekaya0@gmail.com \
--cc=oneukum@suse.com \
--cc=pabeni@redhat.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