llc: fix SAP refcount leak in llc_ui_autobind()
Subsystems (4)
PATCH 1/1 llc: fix SAP refcount leak in llc_ui_autobind()
llc_ui_autobind() opens a SAP after choosing a dynamic LSAP. llc_sap_open() returns a reference owned by the caller, and llc_sap_add_socket() takes a second reference for the socket's membership in the SAP hash tables.
llc_ui_bind() drops the caller's reference after adding the socket, but llc_ui_autobind() keeps it. When the socket is closed, llc_sap_remove_socket() releases only the socket reference, leaving the SAP on llc_sap_list with sk_count == 0.
This is user-visible because repeated autobind and close cycles can consume all dynamic SAP values and make later autobinds fail with -EUSERS.
Drop the caller's reference after a successful autobind, matching llc_ui_bind()'s ownership model.
--- net/llc/af_llc.c | 1 + 1 file changed, 1 insertion(+)
net/llc/af_llc.c +1 -0
@@ -312,6 +312,7 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)/* assign new connection to its SAP */ llc_sap_add_socket (sap, sk);sock_reset_flag (sk,SOCK_ZAPPED ); +llc_sap_put (sap); rc =0 ; out:dev_put (dev);
Signature · 1 line
2.43.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 11 lines · On Tue, 30 Jun 2026 15:48:56 -0400 you wrote:
llc_ui_autobind()opens a SAP after choosing a dynamic LSAP.llc_sap_open()returns a reference owned by the caller, andllc_sap_add_socket()takes a second reference for the socket's membership in the SAP hash tables.
llc_ui_bind()drops the caller's reference after adding the socket, butllc_ui_autobind()keeps it. When the socket is closed,llc_sap_remove_socket()releases only the socket reference, leaving the SAP onllc_sap_listwithsk_count== 0.[...]
Here is the summary with links:
- [net] llc: fix SAP refcount leak in llc_ui_autobind()
https://git.kernel.org/netdev/net/c/660667cd4066
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html