Skip to content

Commit 2c72eb6

Browse files
Xuanqiang LuoPaolo Abeni
authored andcommitted
llc: fix SAP refcount leak when creating incoming sockets
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 3100aa9 ("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. Fixes: 3100aa9 ("llc: fix SAP reference counting w.r.t. socket handling") Cc: stable@vger.kernel.org Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn> Link: https://patch.msgid.link/20260712130343.518797-1-xuanqiang.luo@linux.dev Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 04aeddf commit 2c72eb6

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

net/llc/llc_conn.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ static struct sock *llc_create_incoming_sock(struct sock *sk,
767767
newllc->dev = dev;
768768
dev_hold(dev);
769769
llc_sap_add_socket(llc->sap, newsk);
770-
llc_sap_hold(llc->sap);
771770
out:
772771
return newsk;
773772
}

0 commit comments

Comments
 (0)