From: sashiko-bot@kernel.org
To: "Mina Almasry" <almasrymina@google.com>, dri-devel@lists.freedesktop.org
Cc: media-ci@linuxtv.org
Subject: Re: [PATCH net v2 4/4] selftests: net: add devmem RX and TX netdev unregister tests
Date: Tue, 13 Oct 2026 17:43:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-170250@kernel.org> (raw)
In-Reply-To: <20261012174300.2338784-5-almasrymina@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] selftests: net: test falsely assumes global dma_buf attachments drop to zero
- [Medium] selftests: net: netdevsim device leak on exception paths
--
commit 3ebc183bfb941c2f36dca38f1bd05b883cc61a30
Author: Mina Almasry <almasrymina@google.com>
selftests: net: add devmem RX and TX netdev unregister tests
Add devmem_bind_rx_unregister_check and devmem_bind_tx_unregister_check
to nl_netdev.py to verify that unregistering a netdevsim device while a
netlink socket holds an active RX or TX devmem binding synchronously
detaches the dma_buf attachment and cleanly closes the netlink socket
without use-after-free or page faults.
> diff --git a/tools/testing/selftests/net/nl_netdev.py b/tools/testing/selftests/net/nl_netdev.py
> --- a/tools/testing/selftests/net/nl_netdev.py
> +++ b/tools/testing/selftests/net/nl_netdev.py
[ ... ]
> +def _dmabuf_attached_devs():
> + """Return attached device names from debugfs dma_buf/bufinfo if available."""
> + path = "/sys/kernel/debug/dma_buf/bufinfo"
[ ... ]
> + for line in text.splitlines():
> + if line.strip() == "Attached Devices:":
> + in_attached = True
> + continue
> + if in_attached:
> + if line.startswith("\t") and line.strip():
> + attached.append(line.strip())
[Severity: Medium]
Will this parsing approach unconditionally aggregate all attachments across all
dma_bufs in the system?
Because this does not filter the debugfs output to the specific dma_buf
created by the test, if the system executing the test has any other active
dma_bufs with attachments (e.g., from DRM graphics drivers), the global
attached count will remain non-zero.
> + else:
> + in_attached = False
> + return attached
> +
> +
> +def devmem_bind_rx_unregister_check(_nf) -> None:
> + """Verify RX devmem bindings detach dma_buf synchronously on netdev unregister."""
> + dmabuf_fd = _create_udmabuf()
> + nf_priv = NetdevFamily()
> + ef = EthtoolFamily()
> + nsimdev = NetdevSimDev(queue_count=2)
> + nsim = nsimdev.nsims[0]
[Severity: Medium]
If an exception occurs during the test, will this leak the netdevsim device?
The netdevsim device is instantiated without registering a teardown deferral
like defer(nsimdev.remove) or using a try/finally block. If any step before
the manual nsimdev.remove() call raises an exception, the cleanup is
bypassed. This permanently leaks the kernel netdevsim device and its sysfs
entries in the kernel namespace, potentially causing subsequent tests to fail.
[ ... ]
> + attached = _dmabuf_attached_devs()
> + if attached is not None:
> + ksft_ge(len(attached), 1)
> +
> + nsimdev.remove()
> +
> + attached = _dmabuf_attached_devs()
> + if attached is not None:
> + ksft_eq(len(attached), 0)
[Severity: Medium]
Can this assertion spuriously fail if other dma_bufs exist system-wide?
Since _dmabuf_attached_devs() aggregates all attachments without filtering
for the specific dma_buf created by the test, the attached count will not
drop to zero if the system has other active dma_bufs, causing the test to
fail.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261012174300.2338784-1-almasrymina@google.com?part=4
next prev parent reply other threads:[~2026-10-13 17:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 17:42 [PATCH net v2 0/4] net: devmem: fix RX and TX binding teardown on device unregistration Mina Almasry
2026-10-12 17:42 ` [PATCH net v2 1/4] net: devmem: unmap dma_buf synchronously on queue uninstall Mina Almasry
2026-10-13 17:43 ` sashiko-bot
2026-10-13 18:14 ` netdev-bot+sashiko
2026-10-12 17:42 ` [PATCH net v2 2/4] net: devmem: detach TX bindings on NETDEV_UNREGISTER Mina Almasry
2026-10-13 17:43 ` sashiko-bot
2026-10-13 18:14 ` netdev-bot+sashiko
2026-10-12 17:42 ` [PATCH net v2 3/4] netdevsim: support devmem RX and TX bindings Mina Almasry
2026-10-13 17:43 ` sashiko-bot
2026-10-13 18:14 ` netdev-bot+sashiko
2026-10-12 17:43 ` [PATCH net v2 4/4] selftests: net: add devmem RX and TX netdev unregister tests Mina Almasry
2026-10-13 17:43 ` sashiko-bot [this message]
2026-10-13 18:14 ` netdev-bot+sashiko
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=sashiko-outbox-170250@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=almasrymina@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.