From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17F181F000C1; Tue, 1 Dec 2026 02:15:40 +0000 (UTC) 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== Subject: Re: [PATCH net v2 1/3] net/nfc: llcp: fix the 16-bit truncation that overruns the SNL response skb From: netdev-bot+sashiko@kernel.org To: piyus@iiitd.ac.in 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 Date: Tue, 01 Dec 2026 02:15:39 +0000 Message-ID: <179609133959.3146.7683414965988508365@kernel.org> In-Reply-To: <20261130012208.1962491-2-piyus@iiitd.ac.in> References: <20261130012208.1962491-2-piyus@iiitd.ac.in> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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 > Signed-off-by: Piyus Kedia [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