Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Stanislav Fomichev
Thu, 15 Oct 2026 21:34
Re: [PATCH net v4 2/4] net: devmem: detach TX bindings on NETDEV_UNREGISTER
Author: Stanislav Fomichev
Date: Thu, 15 Oct 2026 21:34
Date: Thu, 15 Oct 2026 21:34
50 lines
11258 bytes
11258 bytes
On 10/15, Mina Almasry wrote:
> TX devmem bindings (NETDEV_CMD_BIND_TX) have no bound RX queues, so
> mp_dmabuf_devmem_uninstall() never runs when binding->dev or
> binding->vdev unregisters. As a result, binding->dev and binding->vdev
> dangle pointing to freed struct net_device memory, and the dma_buf
> remains attached and mapped after device removal.
>
> Closing the netlink socket after netdev unregistration dereferences the
> freed struct net_device in netdev_nl_sock_priv_destroy():
>
> BUG: unable to handle page fault for address: ffff88824ca9b000
> Oops: Oops: 0000 [#1] SMP KASAN NOPTI
> RIP: 0010:netdev_nl_sock_priv_destroy+0xbd/0x1e0
> Call Trace:
> genl_release+0xf5/0x190
> netlink_release+0xd01/0x18d0
> __sock_release+0xb0/0x270
> sock_close+0x18/0x20
>
> Extend net_devmem_dev_unregister() to TX bindings, including ones
> whose netlink socket is already closed but which TCP retransmits keep
> alive:
> - When binding->dev (the physical DMA-capable device) unregisters,
> clear the binding's NET_DEVMEM_BINDING_LIVE mark and both
> binding->dev and binding->vdev, and unmap the dma_buf under
> binding->lock. No grace period is needed: the device is already
> closed, so nothing hands the DMA addresses to the hardware anymore,
> and concurrent senders only compare against binding->dev.
> - When only binding->vdev (virtual device) unregisters while
> binding->dev lives, only clear binding->vdev so no new TX sends match
> the virtual device while allowing in-flight TX packets on binding->dev
> to finish DMA safely.
>
> Fixes: bd61848900bf ("net: devmem: Implement TX path")
> Fixes: 1abe839b34ae ("net: devmem: support TX over NETMEM_TX_NO_DMA devices")
> Suggested-by: Stanislav Fomichev <sdf@fomichev.me>
> Cc: Kaiyuan Zhang <kaiyuanz@google.com>
> Cc: Bobby Eshleman <bobbyeshleman@meta.com>
> Cc: Tariq Toukan <tariqt@nvidia.com>
> Cc: Kaifeng Wang <kaifengw@google.com>
> Assisted-by: LLM
> Signed-off-by: Mina Almasry <almasrymina@google.com>
> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
> ---
> v4:
> - Detach and unmap TX bindings directly from the xarray walk, without a
> grace period or a second pass (Stanislav).
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads