atm: fix skb leak in sigd_send() on a closing listen socket
Subsystems (3)
PATCH 1/1 atm: fix skb leak in sigd_send() on a closing listen socket
In the as_indicate path, sigd_send() pins the listening socket with find_get_vcc() and queues the skb on its receive queue under lock_sock(). It does not check whether the socket is being torn down. If the listener is closed concurrently, vcc_destroy_socket() purges the receive queue once under lock_sock() and removes the socket from vcc_hash; the final free goes __sk_destruct() -> vcc_sock_destruct(), which does not purge. A skb queued after that purge is therefore leaked.
Recheck ATM_VF_CLOSE under lock_sock() before queuing and drop the skb if the socket is closing. ATM_VF_CLOSE is set by vcc_destroy_socket() under the same lock, so the check is serialised against the purge.
Reaching this requires an attached signalling daemon (CAP_NET_ADMIN and CAP_SYS_RAWIO), as only the daemon emits as_indicate.
--- net/atm/signaling.c | 5 +++++ 1 file changed, 5 insertions(+)
net/atm/signaling.c +5 -0
@@ -150,6 +150,11 @@ static int sigd_send(struct atm_vcc *vcc, struct sk_buff *skb) sk =sk_atm (vcc);pr_debug ("as_indicate!!!\n" );lock_sock (sk); +/* Don't queue onto a closing listener; the skb would leak. */ +if (test_bit (ATM_VF_CLOSE , &vcc->flags)) { +dev_kfree_skb (skb); + goto as_indicate_complete; + }if (sk_acceptq_is_full (sk)) {sigd_enq (NULL , as_reject, vcc,NULL ,NULL );dev_kfree_skb (skb);
Signature · 1 line
2.43.0
Jakub Kicinski
maintainerQuoted 7 lines · On Fri, 12 Jun 2026 00:38:06 +0800 Weiming Shi wrote:
In the
as_indicatepath,sigd_send()pins the listening socket withfind_get_vcc()and queues the skb on its receive queue underlock_sock(). It does not check whether the socket is being torn down. If the listener is closed concurrently,vcc_destroy_socket()purges the receive queue once underlock_sock()and removes the socket fromvcc_hash; the final free goes__sk_destruct()->vcc_sock_destruct(), which does not purge. A skb queued after that purge is therefore leaked.
same story here, nobody uses this, I'll delete it instead