From: netdev-bot+sashiko@kernel.org
To: almasrymina@google.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
shuah@kernel.org, linux-kselftest@vger.kernel.org,
bestswngs@gmail.com, daniel@iogearbox.net, razor@blackwall.org,
dw@davidwei.uk, sdf.kernel@gmail.com, bobbyeshleman@meta.com,
dtatulea@nvidia.com
Subject: Re: [PATCH net-next v4 6/7] net: devmem: resolve physical map_dev for leased RX bindings
Date: Mon, 23 Nov 2026 04:59:28 +0000 [thread overview]
Message-ID: <179540996833.3135.12827693293026536068@kernel.org> (raw)
In-Reply-To: <20261120045918.1239746-7-almasrymina@google.com>
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
next prev parent reply other threads:[~2026-11-23 4:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 4:59 [PATCH net-next v4 0/7] net: devmem: support leased RX and TX queues on netdev unregister Mina Almasry
2026-11-20 4:59 ` [PATCH net-next v4 1/7] net: devmem: pass net_device pointer to net_devmem_lock_dev() Mina Almasry
2026-11-20 4:59 ` [PATCH net-next v4 2/7] net: devmem: rename binding dev and vdev to map_dev and bind_dev Mina Almasry
2026-11-20 4:59 ` [PATCH net-next v4 3/7] net: guard memory provider RX queue open and close on unregister Mina Almasry
2026-11-23 4:59 ` netdev-bot+sashiko
2026-11-20 4:59 ` [PATCH net-next v4 4/7] net: devmem: fold net_devmem_lookup_dmabuf() into net_devmem_get_binding() Mina Almasry
2026-11-23 4:59 ` netdev-bot+sashiko
2026-11-20 4:59 ` [PATCH net-next v4 5/7] net: devmem: always populate bind_dev and detach both devices on unregister Mina Almasry
2026-11-23 4:59 ` netdev-bot+sashiko
2026-11-20 4:59 ` [PATCH net-next v4 6/7] net: devmem: resolve physical map_dev for leased RX bindings Mina Almasry
2026-11-23 4:59 ` netdev-bot+sashiko [this message]
2026-11-20 4:59 ` [PATCH net-next v4 7/7] selftests: net: add leased devmem RX and TX netdev unregister tests Mina Almasry
2026-11-20 17:04 ` [PATCH net-next v4 0/7] net: devmem: support leased RX and TX queues on netdev unregister Stanislav Fomichev
2026-11-22 9:16 ` Nikolay Aleksandrov
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=179540996833.3135.12827693293026536068@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=almasrymina@google.com \
--cc=bestswngs@gmail.com \
--cc=bobbyeshleman@meta.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=dw@davidwei.uk \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=sdf.kernel@gmail.com \
--cc=shuah@kernel.org \
/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