Article View: linux.kernel.netdev
Article #24904Re: [PATCH net v2 1/3] net/nfc: llcp: fix the 16-bit truncation that overruns the SNL response skb
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 02:15
Date: Tue, 01 Dec 2026 02:15
118 lines
12221 bytes
12221 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 1 ยท Medium: 0 ยท Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch leaves a remotely triggerable leak on the path it now
relies on.
- [Low] The Signed-off-by chain does not match the recorded authorship.
--
net/nfc: llcp: fix the 16-bit truncation that overruns the SNL response skb
This commit changes the size accumulator in nfc_llcp_allocate_snl() from
u16 to size_t. The SDRES length that nfc_llcp_recv_snl() computes is then
no longer truncated before it reaches alloc_skb(). This prevents the
skb_over_panic() in nfc_llcp_send_snl_sdres() when a peer sends an SNL PDU
with enough SDREQ TLVs to push the total past 65535.
Link: https://lore.kernel.org/netdev/20261123023548.3351531-1-piyus@iiitd.ac.in/
> Signed-off-by: Kapil Vaswani <kapil@presceralabs.ai>
> Signed-off-by: Piyus Kedia <piyus@iiitd.ac.in>
[Severity: Low]
This isn't a bug, but the Signed-off-by chain doesn't match the recorded
authorship. The author is Piyus Kedia, but Kapil Vaswani's Signed-off-by
comes first and there is no Co-developed-by tag.
Documentation/process/submitting-patches.rst says the order of the
Signed-off-by tags should reflect the chronological history of the patch.
It also says every Co-developed-by must be immediately followed by the
co-author's Signed-off-by.
If Kapil Vaswani co-developed this, should there be a Co-developed-by tag
for him immediately before his Signed-off-by? If not, should the tags be
reordered, or that one dropped?
> diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c
> index 80a00938c8696..0a3d66e6cd59f 100644
> --- a/net/nfc/llcp_commands.c
> +++ b/net/nfc/llcp_commands.c
> @@ -542,7 +542,7 @@ static struct sk_buff *nfc_llcp_allocate_snl(struct nfc_llcp_local *local,
> {
> struct sk_buff *skb;
> struct nfc_dev *dev;
> - u16 size = 0;
> + size_t size = 0;
[Severity: High]
With size held in a size_t, the full peer-controlled tlv_length now
reaches alloc_skb(size, GFP_KERNEL). The commit message says:
A request that large may now fail the allocation instead, which the
existing IS_ERR() path in both callers already handles.
Is that true for the SDRES caller? If the allocation fails, does
nfc_llcp_send_snl_sdres() leak every entry on tlv_list?
net/nfc/llcp_commands.c:nfc_llcp_send_snl_sdres() {
...
skb = nfc_llcp_allocate_snl(local, tlvs_len);
if (IS_ERR(skb))
return PTR_ERR(skb);
hlist_for_each_entry_safe(sdp, n, tlv_list, node) {
skb_put_data(skb, sdp->tlv, sdp->tlv_len);
hlist_del(&sdp->node);
nfc_llcp_free_sdp_tlv(sdp);
}
...
}
That loop is the only place the entries are freed, and it only runs when
the allocation succeeds.
The caller ignores the return value. llc_sdres_list is a stack-local
HLIST_HEAD, so it goes out of scope with the entries still linked:
net/nfc/llcp_core.c:nfc_llcp_recv_snl() {
...
exit:
...
if (!hlist_empty(&llc_sdres_list))
nfc_llcp_send_snl_sdres(local, &llc_sdres_list, sdres_tlvs_len);
}
nfc_llcp_build_sdres_tlv() builds each entry. It allocates the
nfc_llcp_sdp_tlv struct with kzalloc_obj() and the TLV buffer with
nfc_llcp_build_tlv().
For the commit message's 16400-SDREQ example, that is two slab objects per
SDREQ, or roughly 1 MB per failed response. The 65600-byte skb head is a
costly-order allocation that can fail when memory is fragmented. A remote
peer can also send such SNL PDUs repeatedly.
The SDREQ caller does clean up. nfc_genl_llc_sdreq() in net/nfc/netlink.c
calls nfc_llcp_free_sdp_tlv_list() unconditionally at its free_list label,
after nfc_llcp_send_snl_sdreq() returns.
None of the later patches in this series change this path.
Could the IS_ERR() path in nfc_llcp_send_snl_sdres() free tlv_list?
Alternatively, nfc_llcp_recv_snl() could call
nfc_llcp_free_sdp_tlv_list(&llc_sdres_list) after the send. Either way, the
commit message would need updating to match.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130012208.1962491-1-piyus%40iiitd.ac.in
Technical Details
Message-ID:
<179609133959.3146.7683414965988508365@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374626-linux-kernel-netdev=dewy.ruReferences:
<20261130012208.1962491-2-piyus@iiitd.ac.in>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374626-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 1/3] net/nfc: llcp: fix the 16-bit truncation that overruns the SNL response skb Date: Tue, 01 Dec 2026 02:15:39 +0000 Organization: Usenet Network Message-ID: <179609133959.3146.7683414965988508365@kernel.org> References: <20261130012208.1962491-2-piyus@iiitd.ac.in> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1590580"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:t+9ikvzE2L+30xKgU5HEAKeifbA= sha256:GaI0kp9aYA8xYY2qdRY6q/BXIMT/hRpnPdBsIzJtYxo= sha1:HA6x4QG2EXQCgmWl8bFLNF5tUQc= sha256:E3pTGyR2ultnN3TXFw8eRgZ4ZJ2LJTDuiPG3qKYIAwk= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8C7531171FE; Tue, 1 Dec 2026 05:16:01 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9ppeYratfh3t; Tue, 1 Dec 2026 05:15:57 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374626-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 4CC0C1171FA; Tue, 1 Dec 2026 05:15:47 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id A34EB29169; Tue, 1 Dec 2026 02:15:42 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796091342; b=bqr/p+6odrLaj0s/7pyKlPdoTCUWs2PoIJK1NhlXMeeyReA0AfFjybp3uFMIxyEjW+Xa PMTak9BULGdEsyjbjPfjMX3xKvJn7UBevFXnyCGnqIBLmqjaZJHa6stfhrighpoZXh2FO KFq4jxQXlFbaMjytKrT3jKbPH8ppdnTRZt/55WASDTfSV9ua7RvAJcNF1zZM9iaCb9hh8 PPezFx0HzQ+hG2YnANmEcYWHINeF8PG89Fbr8pba8zuTFKzPNbA6fMBzu4K103QSh/UUG 2XHT9b2UrSIZ6DZgB/0FBAXo8f1T78MnyNoIYDAvE3aVKZDVx0bhLk6b/ye+Pu+wZIA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796091342; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=0BUWca6QX1QZx7cl6wFi1n5aikvrUB/6tkuTqI3zwhA=; b=jEU7rCLXJgkFCmptU3ddT/Wb6ahndm4P3oOTgsYIf2o5LPU3TzjL0d8/VLTwOWTbwi3P rCol062bOFA91YRWyKE2jn5WFr+GXs7HINqNCvbzAA2DX63wA98Pcuv9VYmGNRCGaDy2u 1xU43sVV9cQQU2PuLyhK95OSuklc3FOoC9vaj3oAcClSFQF+xoLWjzF3r0SVJqxtgxA99 Dsqtgxxy+UAa9lF/4hhZ6UVvAQIcfXeRd44PuW/UmQI72by00gQ7hId2VABcLJ/fQmmgo 697xkxyWOmxDn7DB47iezTnJuQx1Y5Zk4d9y/WZmNJexLwaEUUEdQdJ7yUpFZc3eB0A== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iNnPUZhT; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C9CD606A334; Tue, 1 Dec 2026 02:15:42 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iNnPUZhT X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796091341; b=QYkGwqgonz5QV2+3bD2VrHCKOf9DI5NNN675FRRfDbqD6nDKDKQX6hrw3LxGDRBnsi0m uiLQsZsdhig0Q4OEsWM/4qpSDz/Bt/qNd903cLnKuXNcGdNKMJV4julQ19wmfE4NgXk7Z TMrgYbGere4/qJE6QCHg03z4T77THPBpni3jOrviQNZPbW7DqHh0atOHwgDMP5fWsH1XY qDcjXBWxuwIkLiPtk2xvS92ryqBMNVzWesx31Mw+j5PhMdGuS1+hE91VhaLFDfjCDjPMG YEcNT8kLIVvpYValbSl4PHqz1seUPLZ1dmZ7BoT/iBHVd9oRxkEtoCQ4GiuSDjuoxMg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796091341; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=0BUWca6QX1QZx7cl6wFi1n5aikvrUB/6tkuTqI3zwhA=; b=fxvMNbcldILMwG2Izq5bcQBxTqFZq7rK7OEkkjkqSVMPBgOJK/TYgMUv6+BZiVFPLh61 kiVubzBwSX4q0fGvzMYLYssCs4h/lH68pj3305QL8NEWDhwYtlTu+0yfPNyM9FyVwik+e Nupwg+NSOHdBBCD0B/b60uAzkmp+d4jR8dOu0wg+mpnAi/jyT3rfxRmAQyecws90ndnvt 9jgeK+aFuZJMwvZhb+3P+je+xasDWRpRd0RHTqPtS3P/uOonc05eFmj/0CKiyczE8im6/ pBrfn0j1VylAsykUPOzrgs8eSnkXRxXip70uwXLBGllX+1MLRwsu5CzupHJyE6ZwH/A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iNnPUZhT; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D6B8606A325; Tue, 1 Dec 2026 02:15:40 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17F181F000C1; Tue, 1 Dec 2026 02:15:40 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796091340; bh=0BUWca6QX1QZx7cl6wFi1n5aikvrUB/6tkuTqI3zwhA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=iNnPUZhTlRf8g3UzYQXZcDFZh4HtfHv2bNKgzTXOY2RjSy+NAX6BOssFar6LRYz7r 8mJVuFytZ9qou7TM1Mj9jD+VSVZyKcP6LLuIQR2sqwFCncEQE5Ga+YQFV63xvtXFt9 4Y7AHrai4I0fkL8hQ+OCUm71C/gRJk2v9I5QYTZps4Oc/dpD336mEODHClHGaeTy7K eg2Kl2damebgeMtKIM14MFKdwMYcLwa6peLXTqbZ5xPvf9EP35jUwwMjraBS3U5nJq JCwWyEQ47tg7rqf9HAhPh3UaAHtzIUrMGEFuNIHOlOufaEXcvGd/7AnK9EaSvstIqS cxrzTZE4IBGpQ== X-Cc: david@ixit.cz, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, oe-linux-nfc@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kapil@presceralabs.ai X-In-Reply-To: <20261130012208.1962491-2-piyus@iiitd.ac.in> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list