* Forwarded: [PATCH] nfc: llcp: clear stale device pointers on socket close
[not found] <20260928014639.2230819-1-qwe.aldo@gmail.com>
@ 2026-09-28 1:46 ` syzbot
2026-09-28 3:36 ` [syzbot ci] Re: nfc: llcp: prevent resource leak on repeated connect after DM syzbot ci
0 siblings, 1 reply; 2+ messages in thread
From: syzbot @ 2026-09-28 1:46 UTC (permalink / raw)
To: syzbot; +Cc: syzbot, qwe.aldo
For archival purposes, forwarding an incoming command email to
syzbot@lists.linux.dev.
***
Subject: [PATCH] nfc: llcp: clear stale device pointers on socket close
Author: qwe.aldo@gmail.com
#syz test
nfc_llcp_socket_release() and nfc_llcp_recv_dm() can move a socket
to LLCP_CLOSED without clearing llcp_sock->dev. A bound socket
never owned a device reference (bind puts its temporary ref), and
a connected socket reference is already released here. A later
reconnect attempt would then put a device reference the socket does
not own.
Clear the pointer when a socket becomes closed so that the reconnect
cleanup only puts references it actually holds.
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
---
net/nfc/llcp_core.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c
index cac1b5487..f2530bebe 100644
--- a/net/nfc/llcp_core.c
+++ b/net/nfc/llcp_core.c
@@ -81,8 +81,14 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool device,
nfc_llcp_socket_purge(llcp_sock);
- if (sk->sk_state == LLCP_CONNECTED)
+ if (sk->sk_state == LLCP_CONNECTED) {
nfc_put_device(llcp_sock->dev);
+ llcp_sock->dev = NULL;
+ } else if (sk->sk_state == LLCP_BOUND ||
+ sk->sk_state == LLCP_LISTEN) {
+ /* bind() already dropped its temporary device reference. */
+ llcp_sock->dev = NULL;
+ }
if (sk->sk_state == LLCP_LISTEN) {
struct nfc_llcp_sock *lsk, *n;
@@ -1276,6 +1282,10 @@ static void nfc_llcp_recv_dm(struct nfc_llcp_local *local,
sk = &llcp_sock->sk;
+ /* Bound and listening sockets do not own a device reference. */
+ if (sk->sk_state == LLCP_BOUND || sk->sk_state == LLCP_LISTEN)
+ llcp_sock->dev = NULL;
+
sk->sk_err = ENXIO;
sk->sk_state = LLCP_CLOSED;
sk->sk_state_change(sk);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [syzbot ci] Re: nfc: llcp: prevent resource leak on repeated connect after DM
2026-09-28 1:46 ` Forwarded: [PATCH] nfc: llcp: clear stale device pointers on socket close syzbot
@ 2026-09-28 3:36 ` syzbot ci
0 siblings, 0 replies; 2+ messages in thread
From: syzbot ci @ 2026-09-28 3:36 UTC (permalink / raw)
To: syzbot, qwe.aldo, syzbot; +Cc: syzbot, syzkaller-bugs
syzbot ci has tested the suggested fix patch on top of the following series:
[v2] nfc: llcp: prevent resource leak on repeated connect after DM
https://lore.kernel.org/all/20260925184857.357926-1-qwe.aldo@gmail.com
Patch: https://ci.syzbot.org/jobs/da6ffc80-6044-443a-a9ca-b63e5a06610d/patch
Testing results:
* [build 0] Build Patched: passed
* [build 0] Boot test: Patched: passed
* [build 0] Previous reproducers: passed
- KASAN: slab-use-after-free Read in llcp_sock_connect (patched) - passed
- KASAN: slab-use-after-free Read in nfc_remove_device (patched) - passed
Full report is available here:
https://ci.syzbot.org/session/3f61304c-d949-4760-b6a1-f43b0fb5862d
---
This report is generated by a bot. It may contain errors.
syzbot ci engineers can be reached at syzkaller@googlegroups.com.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-28 3:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260928014639.2230819-1-qwe.aldo@gmail.com>
2026-09-28 1:46 ` Forwarded: [PATCH] nfc: llcp: clear stale device pointers on socket close syzbot
2026-09-28 3:36 ` [syzbot ci] Re: nfc: llcp: prevent resource leak on repeated connect after DM syzbot ci
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.