๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by netdev-bot+sashiko Mon, 23 Nov 2026 04:59
Re: [PATCH net-next v4 6/7] net: devmem: resolve physical map_dev for leased RX bindings
#20721
Author: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 04:59
71 lines
11123 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message for "net: devmem: resolve physical map_dev for
  leased RX bindings" describes a use-after-free and has no Fixes: tag.

--

net: devmem: resolve physical map_dev for leased RX bindings

This commit makes netdev_nl_get_dma_dev() return the physical backing
netdev when an RX queue is leased. That netdev is used as map_dev for
net_devmem_bind_dmabuf() and is locked around the call. With map_dev now
always the physical DMA device, the commit drops the
!netif_is_queue_leasee(dev) guard in net_devmem_dev_unregister(), so
leased RX bindings get unmapped when the physical netdev unregisters.

> Previously, netdev_nl_bind_rx_doit() passed netdev as both map_dev and
> bind_dev to net_devmem_bind_dmabuf(), so leased RX bindings stored the
> virtual netdev in binding->map_dev without tracking the physical backing
> netdev at all. When the physical backing netdev unregistered while a
> leased RX binding was active, net_devmem_dev_unregister() did not match
> the physical netdev and mp_dmabuf_devmem_uninstall() on the virtual
> queue skipped unmapping because rxq->lease was set, leaving the dmabuf
> attachment mapped against the freed physical dma_dev until
> __net_devmem_dmabuf_binding_free() triggered a use-after-free in
> dma_unmap_sg_attrs().

[ ... ]

> Suggested-by: Stanislav Fomichev <sdf@fomichev.me>
> Signed-off-by: Mina Almasry <almasrymina@google.com>

[Severity: Low]
Should this commit carry Fixes: tags? The use-after-free described above
seems to come from two earlier commits together.

The first is 222b5566a02d ("net: Proxy netdev_queue_get_dma_dev for leased
queues"). It made devmem bind-rx possible on a virtual leasee such as
netkit, but netdev_nl_bind_rx_doit() still passed the virtual netdev as
both map_dev and bind_dev.

The second is c4466d2c3e77 ("net: devmem: unmap dma_buf synchronously on
queue uninstall"). It added the guard in net_devmem_dev_unregister() that
this patch removes:

    if (!netif_is_queue_leasee(dev))
        net_devmem_dmabuf_binding_unmap(binding);

c4466d2c3e77 fixed the non-leased form of the same use-after-free and has
two Fixes: tags. Without a tag here, could stable trees that contain both
commits keep the leased form unfixed? For example:

Fixes: 222b5566a02d ("net: Proxy netdev_queue_get_dma_dev for leased queues")
Fixes: c4466d2c3e77 ("net: devmem: unmap dma_buf synchronously on queue uninstall")

The fix also depends on earlier patches in this series that the commit
message doesn't mention. netif_lease_valid() comes from "net: guard memory
provider RX queue open and close on unregister". bind_dev is only always
populated after "net: devmem: always populate bind_dev and detach both
devices on unregister".

If this commit were backported alone, wouldn't it fail to build or behave
differently? Could the commit message list these dependencies?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120045918.1239746-1-almasrymina%40google.com
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