* [PATCH net] atm: Fix atm_dev reference leak on VCC close for built-in drivers
@ 2026-11-26 13:42 Yige Jiang
2026-11-26 13:48 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Yige Jiang @ 2026-11-26 13:42 UTC (permalink / raw)
To: Chas Williams, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Yige Jiang, Simon Horman, linux-atm-general, netdev,
linux-kernel, Willem de Bruijn, stable
vcc_connect() takes a reference on the atm_dev, and __vcc_connect()
stores the device in vcc->dev together with a reference on
dev->ops->owner. vcc_destroy_socket() drops both only when
dev->ops->owner is non-NULL. usbatm and solos-pci set .owner to
THIS_MODULE, which is NULL when they are built in, so in that
configuration every connected PVC leaks one atm_dev reference on close.
After atm_dev_deregister() the count then never reaches zero, so
->dev_close() is not called and the atm_dev, and for usbatm the driver
instance, are never freed.
The owner check was added so that static meta devices such as
lecatm_dev and sigd_dev, which were attached without a reference, were
not put. The last of them was removed by commit aa582dc25ace ("atm:
remove SVC socket support and the signaling daemon interface"), and
__vcc_connect() is now the only place that sets vcc->dev, always with a
reference held. Drop the reference whenever vcc->dev is set.
module_put(NULL) is a no-op, so modular drivers still get exactly one
module_put() and one atm_dev_put() per close.
Kernels before 7.2 still have the meta devices, so a backport there
must keep skipping atm_dev_put() for them.
Fixes: 93a2014afbac ("atm: fix a UAF in lec_arp_clear_vccs()")
Cc: stable@vger.kernel.org # 7.2.x
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on linux-next next-20261109 (630059a5a632).
Compile-tested: arm64, GCC 14.2.0, W=1, defconfig + CONFIG_COMPILE_TEST=y, CONFIG_ATM=y (net/atm/common.o; no new warnings vs base).
Runtime-tested in QEMU (arm64 virt, KASAN, kmemleak) on a model: a test module that registers an atm_dev with ops->owner == NULL stands in for a built-in driver. Before the patch each connect/close cycle leaves one more reference and the device is never released after deregistration; after it the count returns to 1 and the device is released. A device with ops->owner == THIS_MODULE sees no double put. No hardware test.
Triggered by close() of a PF_ATMPVC socket that was connected to a usbatm or solos-pci device built into the kernel; the leak shows once the device is removed.
Stable is limited to 7.2.x because before aa582dc25ace (v7.2-rc1) the static meta devices still reach vcc_destroy_socket() without a reference, and this change would put them.
A real built-in usbatm or solos device (USB unplug) was not tested.
net/atm/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/atm/common.c b/net/atm/common.c
index 8119572..f68bf8d 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -184,7 +184,7 @@ static void vcc_destroy_socket(struct sock *sk)
kfree_skb(skb);
}
- if (vcc->dev && vcc->dev->ops->owner) {
+ if (vcc->dev) {
module_put(vcc->dev->ops->owner);
atm_dev_put(vcc->dev);
}
base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net] atm: Fix atm_dev reference leak on VCC close for built-in drivers
2026-11-26 13:42 [PATCH net] atm: Fix atm_dev reference leak on VCC close for built-in drivers Yige Jiang
@ 2026-11-26 13:48 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-26 13:48 UTC (permalink / raw)
To: Yige Jiang
Cc: Chas Williams, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, linux-atm-general, netdev,
linux-kernel, Willem de Bruijn, stable
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 13:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 13:42 [PATCH net] atm: Fix atm_dev reference leak on VCC close for built-in drivers Yige Jiang
2026-11-26 13:48 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®