Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Yige Jiang
Thu, 26 Nov 2026 13:42
[PATCH net] atm: Fix atm_dev reference leak on VCC close for built-in drivers
Author: Yige Jiang
Date: Thu, 26 Nov 2026 13:42
Date: Thu, 26 Nov 2026 13:42
54 lines
13545 bytes
13545 bytes
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
Re: [PATCH net] atm: Fix atm_dev reference leak on VCC close for built-in drivers
Author: netdev-bot+sinfo
Date: Thu, 26 Nov 2026 13:48
Date: Thu, 26 Nov 2026 13:48
19 lines
8564 bytes
8564 bytes
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.
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