Re: [PATCH] nfc: llcp: walk the accept queue under the socket lock

From: Eric Dumazet

Date: Wed Nov 18 2026 - 06:05:21 EST


Le mer. 18 nov. 2026 à 09:38, Henry Martin <bsdhenrymartin@xxxxxxxxx> a écrit :
>
> llcp_accept_poll() walks parent->accept_queue and reads each child's
> sk_state without holding the socket lock. nfc_llcp_accept_dequeue()
> unlinks closed children and drops their creation reference under that
> lock, and the last sock_put() frees the child.
>
> A poll() racing with accept() therefore reads a freed child:
>
> BUG: KASAN: slab-use-after-free in llcp_sock_poll+0x440/0x4e0
> Read of size 1 at addr ffff888112387812 by task poc.bin/528
> Allocated by task 198:
> nfc_llcp_sock_alloc
> nfc_llcp_rx_skb
> Freed by task 529:
> __sk_destruct
> nfc_llcp_accept_dequeue
>
> Take the listener lock around the accept queue walk.
>
> This issue was discovered by Tencent CodeBuddy Security.
>
> Fixes: d646960f7986 ("NFC: Initial LLCP support")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Henry Martin <bsdhenrymartin@xxxxxxxxx>
> ---
> net/nfc/llcp_sock.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>

Next time, please specify the target tree in the subject ([PATCH net]).

Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>

Also, make sure to wait a least 24 hours between versions (
Documentation/process/maintainer-netdev.rst )