Re: [PATCH net v2] net: ntb_netdev: Fix statistics races

From: Jakub Kicinski

Date: Fri Aug 28 2026 - 16:50:16 EST


On Sat, 29 Aug 2026 00:41:22 +0900 Koichiro Den wrote:
> Note that transport callbacks may still complete after
> unregister_netdev(), so tie the tstats lifetime to the client device.

We shouldn't really call devm_netdev_alloc_pcpu_stats() for types
of stats declared by netdev core. We should set the pointer type
like you did in v1.

Could you instead fix the fact that the Tx callback runs on
an unregistered device? Maybe just wrap the whole body of
ntb_netdev_tx_handler() in RCU and check

READ_ONCE(ndev->reg_state) == NETREG_REGISTERED

?