Re: [PATCH net v6] usbnet: fix smp_processor_id() use in preemptible context
From: Alan Stern
Date: Thu Oct 08 2026 - 10:16:26 EST
On Wed, Oct 07, 2026 at 08:00:49PM -0700, Jakub Kicinski wrote:
> On Mon, 5 Oct 2026 00:59:25 +0300 Ömer Mete Kaya wrote:
> > tx_complete() calls this_cpu_ptr() before disabling preemption, which
> > triggers a BUG when running with CONFIG_DEBUG_PREEMPT:
> >
> > BUG: using smp_processor_id() in preemptible code in tx_complete
> >
> > Fix by using get_cpu_ptr()/put_cpu_ptr() which disable preemption and
> > return the per-CPU pointer atomically. The usbnet_skb_return() hunk
> > is a hardening change: that path runs in softirq context so no warning
> > fires there, but the same fix is applied for consistency.
>
> This looks odd, how did we miss this for 8 years.
>
> Greg is probably busy, but would be good to get a confirmation
> from either him or some other USB expert that the callbacks
> can indeed be called in process context.
They can be called in BH context with interrupts enabled. Is that close
enough?
Alan Stern