llc: fix SAP refcount leak when creating incoming sockets
Subsystems (4)
PATCH 1/1 llc: fix SAP refcount leak when creating incoming sockets
From: Xuanqiang Luo <[email protected]>
llc_sap_add_socket() takes a SAP reference for each socket added to a SAP, and llc_sap_remove_socket() releases it. llc_create_incoming_sock() takes an additional SAP reference after adding the child socket.
This extra reference was balanced by an explicit llc_sap_put() in llc_ui_release() until commit 3100aa9d74db ("llc: fix SAP reference counting w.r.t. socket handling") removed that put. The corresponding hold in the accept path was left behind.
When such a child socket is removed, only the reference taken by llc_sap_add_socket() is released. The extra reference keeps the SAP alive after its last socket is removed. Remove the obsolete hold.
--- net/llc/llc_conn.c | 1 - 1 file changed, 1 deletion(-)
net/llc/llc_conn.c +0 -1
@@ -767,7 +767,6 @@ static struct sock *llc_create_incoming_sock(struct sock *sk, newllc->dev = dev;dev_hold (dev);llc_sap_add_socket (llc->sap, newsk); -llc_sap_hold (llc->sap); out:return newsk; }
Signature · 1 line
2.51.0
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 6 lines · On Sun, 12 Jul 2026 21:03:43 +0800 you wrote:
From: Xuanqiang Luo <[email protected]>
llc_sap_add_socket()takes a SAP reference for each socket added to a SAP, andllc_sap_remove_socket()releases it.llc_create_incoming_sock()takes an additional SAP reference after adding the child socket.
Quoted 6 lines
This extra reference was balanced by an explicit
llc_sap_put()inllc_ui_release()until commit3100aa9d74db("llc: fix SAP reference counting w.r.t. socket handling") removed that put. The corresponding hold in the accept path was left behind.[...]
Here is the summary with links:
- [net,v1] llc: fix SAP refcount leak when creating incoming sockets
https://git.kernel.org/netdev/net/c/2c72eb628634
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html