<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/net/nfc, branch stable</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/net/nfc?h=stable</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/net/nfc?h=stable'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2026-09-23T20:13:17Z</updated>
<entry>
<title>nfc: llcp: fix slab-out-of-bounds reads when logging service names</title>
<updated>2026-09-23T20:13:17Z</updated>
<author>
<name>Ömer Mete Kaya</name>
<email>omermetekaya0@gmail.com</email>
</author>
<published>2026-09-08T16:18:01Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=7dcf371a35632f035baf77bcf2c129165f772ce4'/>
<id>urn:sha1:7dcf371a35632f035baf77bcf2c129165f772ce4</id>
<content type='text'>
nfc_llcp_wks_sap() and nfc_llcp_build_sdreq_tlv() pass non-null-
terminated strings to pr_debug() using the %s format specifier.
The buffers are allocated via kmemdup() or come from netlink
attributes and are not guaranteed to be null-terminated, causing
__dynamic_pr_debug() to read beyond the allocated region:

  KASAN: slab-out-of-bounds Read in __dynamic_pr_debug

Fix both call sites by using %.*s with the explicit length to limit
the output to the actual length of the string.

Fixes: d9b8d8e19b07 ("NFC: llcp: Service Name Lookup netlink interface")
Reported-by: syzbot+1e3df0852e82c21ca418@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1e3df0852e82c21ca418
Signed-off-by: Ömer Mete Kaya &lt;omermetekaya0@gmail.com&gt;
Link: https://patch.msgid.link/20260908161952.731468-1-omermetekaya0@gmail.com
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
<entry>
<title>nfc: llcp: fix WKS SAP hijacking via prefix match in nfc_llcp_wks_sap()</title>
<updated>2026-09-23T20:13:17Z</updated>
<author>
<name>Ömer Mete Kaya</name>
<email>omermetekaya0@gmail.com</email>
</author>
<published>2026-09-09T12:14:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=408cff6bd60636df201274d320edfdfde9ed41db'/>
<id>urn:sha1:408cff6bd60636df201274d320edfdfde9ed41db</id>
<content type='text'>
nfc_llcp_wks_sap() compares only service_name_len bytes, so a short
service_name like "u" matches longer WKS strings like "urn:nfc:sn:snep".
Fix by requiring exact length match before strncmp().

Fixes: d646960f7986 ("NFC: Initial LLCP support")
Signed-off-by: Ömer Mete Kaya &lt;omermetekaya0@gmail.com&gt;
Link: https://patch.msgid.link/20260909121437.33744-1-omermetekaya0@gmail.com
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
<entry>
<title>nfc: llcp: fix -ENOMEM on connect with zero-length service name</title>
<updated>2026-09-23T20:13:17Z</updated>
<author>
<name>Ömer Mete Kaya</name>
<email>omermetekaya0@gmail.com</email>
</author>
<published>2026-09-09T12:16:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=c04981e42d94f39c1dba965cc462a046e946a6c5'/>
<id>urn:sha1:c04981e42d94f39c1dba965cc462a046e946a6c5</id>
<content type='text'>
When service_name_len is 0, kmemdup() returns ZERO_SIZE_PTR which
passes the NULL check, causing nfc_llcp_send_connect() to attempt
building a zero-length service name TLV and fail with -ENOMEM.

Fix by setting service_name to NULL directly when service_name_len is 0.

Fixes: d646960f7986 ("NFC: Initial LLCP support")
Signed-off-by: Ömer Mete Kaya &lt;omermetekaya0@gmail.com&gt;
Link: https://patch.msgid.link/20260909122029.34081-1-omermetekaya0@gmail.com
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
<entry>
<title>nfc: fix use-after-free in nfc_get_local_general_bytes</title>
<updated>2026-09-23T20:13:17Z</updated>
<author>
<name>Luxiao Xu</name>
<email>rakukuip@gmail.com</email>
</author>
<published>2026-09-09T05:19:24Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=dcab71a7011918f6fdba7adcec02d217dcb84b8d'/>
<id>urn:sha1:dcab71a7011918f6fdba7adcec02d217dcb84b8d</id>
<content type='text'>
Commit 6709d4b7bc2e ("net: nfc: Fix use-after-free caused by
nfc_llcp_find_local") attempted to fix a use-after-free (UAF) issue by
invoking nfc_llcp_local_put(local) after accessing local-&gt;gb. However,
if the reference count drops to zero, local is freed immediately,
leading to a use-after-free when callers access the returned pointer.
Alternative approaches using dynamic allocation (e.g. kmemdup) introduced
memory leaks because callers consistently treat the returned pointer as
borrowed memory.

Fix this properly by refactoring nfc_llcp_general_bytes() and
nfc_get_local_general_bytes() to accept a caller-provided output buffer
(out_gb) and its maximum length (gb_max_len). The general bytes are
safely copied into out_gb before calling nfc_llcp_local_put(local),
ensuring safe lifetime management without ownership transfer complications.

Update all callers across drivers (microread, pn533, pn544, st21nfca,
digital_dep, and nci) to provide their own destination buffers and pass
them to nfc_get_local_general_bytes().

Fixes: 6709d4b7bc2e ("net: nfc: Fix use-after-free caused by nfc_llcp_find_local")
Cc: stable@vger.kernel.org
Reported-by: Vega &lt;vega@nebusec.ai&gt;
Assisted-by: LLM
Signed-off-by: Luxiao Xu &lt;rakukuip@gmail.com&gt;
Signed-off-by: Ren Wei &lt;weir@nebusec.ai&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Link: https://patch.msgid.link/3cbaac3bee23f8ff3a3284ed32d347696eb1d208.1788841683.git.rakukuip@gmail.com
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
<entry>
<title>nfc: llcp: fix sdreq TLV list leak on parse/alloc/send failure</title>
<updated>2026-09-23T20:13:17Z</updated>
<author>
<name>Cong Nguyen</name>
<email>congnt264@gmail.com</email>
</author>
<published>2026-09-14T12:11:29Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=66f4300206b82b0b143ef0d9be90cd8d29f23a47'/>
<id>urn:sha1:66f4300206b82b0b143ef0d9be90cd8d29f23a47</id>
<content type='text'>
nfc_genl_llc_sdreq() builds a list of TLV nodes while walking nested
netlink attrs, but 3 error paths (nested-attr parse failure, TLV alloc
ENOMEM, nfc_llcp_send_snl_sdreq() failure) all skip freeing what was
already queued.

Route them through a new free_list label, mirroring the SDRES path in
the same file which already does this. Harmless on the success path
too -- send_snl_sdreq() drains the list as it moves nodes, so it's
already empty by the time free_list runs.

Fixes: d9b8d8e19b07 ("NFC: llcp: Service Name Lookup netlink interface")
Assisted-by: Claude:claude-opus-4
Signed-off-by: Cong Nguyen &lt;congnt264@gmail.com&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Link: https://patch.msgid.link/20260914121129.2098606-1-congnt264@gmail.com
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
<entry>
<title>nfc: llcp: drop truncated I/RR/RNR PDUs in nfc_llcp_recv_hdlc()</title>
<updated>2026-09-23T20:13:17Z</updated>
<author>
<name>Aamir Ahmed</name>
<email>elb12345@hotmail.co.uk</email>
</author>
<published>2026-09-15T18:54:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=273f9d667cde649f8de9d72b1303cc2f4b658c50'/>
<id>urn:sha1:273f9d667cde649f8de9d72b1303cc2f4b658c50</id>
<content type='text'>
nfc_llcp_recv_hdlc() reads the sequence byte skb-&gt;data[2], via
nfc_llcp_ns()/nfc_llcp_nr(), before any length check. The receive path
only guarantees the two-byte LLCP header -- __nfc_llcp_recv() checks it
with pskb_may_pull() and nfc_llcp_recv_agf() admits two-byte inner PDUs
-- so a two-byte I, RR or RNR PDU reads one byte of uninitialised skb
tailroom. The byte becomes N(R)/N(S); a peer can already set those with
a well-formed PDU, so this is acting on uninitialised memory, not new
peer control.

Guard the read with pskb_may_pull(), as commit 95674f506c63 ("nfc: llcp:
reject PDUs shorter than the LLCP header") did for the two-byte header,
so the sequence byte is present and linear before it is read. RR and RNR
PDUs are LLCP_HEADER_SIZE + LLCP_SEQUENCE_SIZE bytes and an I PDU is
longer, so no valid frame is rejected; a truncated PDU is malformed, so
return without a DM reply.

Fixes: d646960f7986 ("NFC: Initial LLCP support")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Aamir Ahmed &lt;elb12345@hotmail.co.uk&gt;
Reviewed-by: Simon Horman &lt;horms@kernel.org&gt;
Link: https://patch.msgid.link/AS8P251MB0001789BBF04B72745C7D96BC8BA2@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
<entry>
<title>nfc: llcp: Fix race condition in accept_queue lifecycle</title>
<updated>2026-09-23T20:13:16Z</updated>
<author>
<name>Lee Jones</name>
<email>lee@kernel.org</email>
</author>
<published>2026-09-02T12:30:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=c3eef2f988a3db9690369d7cef9a3344dd9788d3'/>
<id>urn:sha1:c3eef2f988a3db9690369d7cef9a3344dd9788d3</id>
<content type='text'>
In nfc_llcp_socket_release(), sockets and listener accept queues are
walked under the local sockets rwlock and bh_lock_sock().  However,
bh_lock_sock() does not synchronise against process-context lock_sock()
held by nfc_llcp_accept_dequeue() during accept().  Because
socket_release() does not check sock_owned_by_user(), both paths can
concurrently unlink and release the same child socket, resulting in
use-after-free or a NULL pointer dereference of child-&gt;parent in
nfc_llcp_accept_unlink().

Fix this synchronisation race by having nfc_llcp_socket_release() use
process-context lock_sock() instead of bh_lock_sock():

1. Pop sockets from the local sockets list under the write lock using
   nfc_llcp_sock_list_pop() so lock_sock() can be acquired without
   holding the rwlock.

2. Because lock_sock() can sleep, defer the final release of the
   nfc_llcp_local structure to a workqueue (release_work).  This avoids
   a sleeping-in-atomic bug when the last local reference is dropped
   from softirq context.  Additionally, hold a single device reference
   on local from registration until final destruction.

3. In nfc_llcp_local_get(), use kref_get_unless_zero() to prevent
   resurrecting a local object whose teardown has been scheduled.

4. In llcp_sock_accept(), verify that the listener socket state is still
   LLCP_LISTEN after waking from schedule_timeout() to prevent hangs if
   the listener is closed concurrently.

5. When unlinking unaccepted child sockets during listener release,
   unlink them from local-&gt;sockets, call sock_orphan(), and drop their
   initial sk_alloc creation reference via sock_put().

6. Make nfc_llcp_accept_unlink() idempotent by guarding parent access with
   a NULL check.

Fixes: 50b78b2a6500 ("NFC: Fix sleeping in atomic when releasing socket")
Signed-off-by: Lee Jones &lt;lee@kernel.org&gt;
Link: https://patch.msgid.link/20260902123033.1169067-1-lee@kernel.org
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
<entry>
<title>nfc: llcp: Fix list corruption / refcount desync in nfc_llcp_recv_dm()</title>
<updated>2026-09-23T20:13:15Z</updated>
<author>
<name>Aldo Ariel Panzardo</name>
<email>qwe.aldo@gmail.com</email>
</author>
<published>2026-07-16T23:26:57Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=bf1460acdf8cf5a07c819f59785d40f20d113099'/>
<id>urn:sha1:bf1460acdf8cf5a07c819f59785d40f20d113099</id>
<content type='text'>
nfc_llcp_recv_dm() handles DM(NOBOUND)/DM(REJ) for a socket that is still
linked on local-&gt;connecting_sockets: it looks the socket up with
nfc_llcp_connecting_sock_get(), sets sk-&gt;sk_state = LLCP_CLOSED and
returns, without taking the socket lock and without unlinking the socket
from the connecting_sockets list.

llcp_sock_release() selects the list to unlink from by sk_state: a socket
in LLCP_CONNECTING is unlinked from connecting_sockets, otherwise from the
sockets list.  Because recv_dm left the socket physically on
connecting_sockets but in the LLCP_CLOSED state, release() takes the else
branch and calls nfc_llcp_sock_unlink(&amp;local-&gt;sockets, sk).  That runs
sk_del_node_init() while holding sockets.lock, i.e. it removes the socket
from the connecting_sockets hlist under the wrong lock.  A concurrent
connect() linking another socket onto connecting_sockets under
connecting_sockets.lock then mutates the same hlist unserialized, which
corrupts the list and desyncs the sk_add_node()/sk_del_node_init()
sock_hold()/__sock_put() pairing.  An unprivileged local process holding
LLCP sockets, with the DM supplied by the remote peer over an established
LLCP link, can drive this to leak kernel sockets without bound (the
mis-decrement goes through the non-freeing __sock_put() path, so the
object is never released), leading to memory exhaustion / DoS.

This is the same class of bug that was fixed in the sibling handler
nfc_llcp_recv_cc() by commit b493ea2765cc ("nfc: llcp: Fix use-after-free
race in nfc_llcp_recv_cc()"); recv_dm did not receive the equivalent fix.

Fix it the same way: take lock_sock(), re-check that the socket is still
hashed (release() may have won the race), and for the NOBOUND/REJ case
unlink it from connecting_sockets before moving it to LLCP_CLOSED.  The
unlink drops the connecting_sockets membership reference via
sk_del_node_init(), leaving the socket unhashed, so the later
nfc_llcp_sock_unlink() in llcp_sock_release() becomes a no-op and no
double put occurs.

Fixes: a69f32af86e3 ("NFC: Socket linked list")
Signed-off-by: Aldo Ariel Panzardo &lt;qwe.aldo@gmail.com&gt;
Link: https://patch.msgid.link/20260716232657.203145-1-qwe.aldo@gmail.com
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
<entry>
<title>nfc: nci: free destination parameters when closing a connection</title>
<updated>2026-08-11T16:10:04Z</updated>
<author>
<name>Linmao Li</name>
<email>lilinmao@kylinos.cn</email>
</author>
<published>2026-07-21T02:35:18Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=2e65bafdfd3a8bba972b3d17b6a57816557530fc'/>
<id>urn:sha1:2e65bafdfd3a8bba972b3d17b6a57816557530fc</id>
<content type='text'>
When a connection is closed, nci_core_conn_close_rsp_packet() frees
conn_info but not conn_info-&gt;dest_params, which is a separate devm
allocation. Each connect/close cycle leaks one dest_params until the
NFC device is removed. Free dest_params along with conn_info.

Fixes: 9b8d1a4cf2aa ("nfc: nci: Add an additional parameter to identify a connection id")
Cc: stable@vger.kernel.org
Signed-off-by: Linmao Li &lt;lilinmao@kylinos.cn&gt;
Reviewed-by: Vadim Fedorenko &lt;vadim.fedorenko@linux.dev&gt;
Link: https://patch.msgid.link/20260721023518.1697625-1-lilinmao@kylinos.cn
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
<entry>
<title>nfc: nci: fix use of uninitialized memory in CORE_INIT_RSP parsing</title>
<updated>2026-08-11T16:10:04Z</updated>
<author>
<name>Yun Zhou</name>
<email>yun.zhou@windriver.com</email>
</author>
<published>2026-05-27T05:26:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=d56575a2595ee1f597f39e8a1cfb67ed3501678d'/>
<id>urn:sha1:d56575a2595ee1f597f39e8a1cfb67ed3501678d</id>
<content type='text'>
nci_core_init_rsp_packet_v1() and nci_core_init_rsp_packet_v2() parse
the CORE_INIT_RSP packet without validating that the skb contains
enough data. A malformed response (e.g. injected via virtual_ncidev)
can declare a large num_supported_rf_interfaces while providing
insufficient data, causing reads of uninitialized slab memory. This
is later used in nci_init_complete_req(), triggering a KMSAN
uninit-value warning.

Add skb length checks before accessing packet fields:
- Validate the skb has at least 1 byte for the status field.
- Validate the skb can hold the fixed-size header before parsing.
- In v2, bounds-check each variable-length rf_interface entry and its
  extension parameters within the parsing loop.
- In v1, verify the skb is large enough for both the variable-length
  rf_interfaces array and the trailing rsp_2 structure.

Reported-by: syzbot+46ca2592193f2fb3debc@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=46ca2592193f2fb3debc
Fixes: bcd684aace34 ("net/nfc/nci: Support NCI 2.x initial sequence")
Signed-off-by: Yun Zhou &lt;yun.zhou@windriver.com&gt;
Link: https://patch.msgid.link/20260527052625.3309581-1-yun.zhou@windriver.com
Signed-off-by: David Heidelberg &lt;david@ixit.cz&gt;
</content>
</entry>
</feed>
