Article View: linux.kernel.netdev
Article #18671Re: [PATCH net 2/2] nfc: st21nfca: Free the ATR_REQ skb after sending it
From: Simon Horman
Date: Wed, 18 Nov 2026 18:16
Date: Wed, 18 Nov 2026 18:16
29 lines
8867 bytes
8867 bytes
On Thu, Nov 12, 2026 at 10:04:49AM +0000, Suyuan Wang via B4 Relay wrote:
> From: Suyuan Wang <stevewong@hust.edu.cn>
>
> st21nfca_im_send_atr_req() allocates an skb for the ATR_REQ, passes
> its data to the HCI layer and then forgets about it:
>
> return nfc_hci_send_cmd_async(hdev, ST21NFCA_RF_READER_F_GATE,
> ST21NFCA_WR_XCHG_DATA, skb->data,
> skb->len, info->async_cb, info);
>
> nfc_hci_send_cmd_async() copies the payload into its own fragments, so
> the skb is still ours to free. As it is, one skb leaks on every ATR_REQ
> sent in initiator mode, whether or not the command was queued.
>
> Free it right after the call, on success and on error, as
> st21nfca_tx_work() does for the same call.
>
> Found with a static analysis tool and checked by hand.
>
> Fixes: 1892bf844ea0 ("NFC: st21nfca: Adding P2P support to st21nfca in Initiator & Target mode")
> Cc: stable@vger.kernel.org
> Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
> Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
> Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
> ---
> Compile tested only, I don't have ST21NFCA hardware.
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261118181650.GQ860048@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366325-linux-kernel-netdev=dewy.ruReferences:
<20261112-nfc-v1-0-ab0ef166f382@gmail.com> <20261112-nfc-v1-2-ab0ef166f382@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366325-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/2] nfc: st21nfca: Free the ATR_REQ skb after sending it Date: Wed, 18 Nov 2026 18:16:50 +0000 Organization: Usenet Network Message-ID: <20261118181650.GQ860048@horms.kernel.org> References: <20261112-nfc-v1-0-ab0ef166f382@gmail.com> <20261112-nfc-v1-2-ab0ef166f382@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2661412"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:i7I4/jUClGw68OmIEw45kmEY8DM= sha256:YdjTfPKT8hzZ+Ksz7EL34+UXlzJlUCWH7OJ55pMufv8= sha1:XVcRWKQ56X0nUB2ec57a9xfLwnk= sha256:LM/MFC6BJnn6gi18dVXCBt3G1vUYX4WFazGCC9wfdQY= Content-Disposition: inline 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 62CB3115359; Wed, 18 Nov 2026 21:17:09 +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 ujG1yZU-KGiP; Wed, 18 Nov 2026 21:17:06 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366325-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 B8A68114CB4; Wed, 18 Nov 2026 21:16:57 +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 00F2DC1900; Wed, 18 Nov 2026 18:16:55 +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=1795025815; b=AoC40NG+EZDsbTSWmRcBfLYsW5gwBnsaDQb2FV0y3d+GcNYIE+edRg3l0/D/Y5o2QM5/ h30v/Ajvfu/kuGTx3PfdXoG9m3PX8GpaX98Y2xj5kouLfuwvgZYrkyG1jUKZmSk2Wzziw 8uEskbNWlWLOzJt7q64QauxMv2CR/lbsSP8c3koOUgmbIL1YsN8NS28AZ63exd5jbBo4t +QpCTFWWWpv+2EpVArhCWKwc5MpHNe+cdC2qKtatX32+vNOoI483XsOpOCdiyMogYlGJ6 bZzVdcFn9D3YfaKN13WrpgZq8lo4x1pEIDVuA3e1PL6X/lgsv9Wls6SdkzL0LIB1ORA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795025815; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=8xIQBbs0SQnfnb2Q6EmYFwPaMd/Q9LTyn9jZVwWF/mk=; b=LEIIjxU5P7m45uWR5bi63Hgc2jLO+tH3ZcfH9suN0gi0qUxIopj8zLkR2XxeFrcpNsZ/ RbENHvwxEHSmjh6Erj0szFGX/KTnkvTZp5ybZexrLrWA0KgwSKROKWtFuUsdSyV1bQqM9 JvdeVMCcG5uP7Rg4ukVjhoEX77ebMWApQsZOiTJA/z55oxXvgI896/lF58oTWsp6zs/W6 s/b0FhzveR32K9VLAUPmkgRN0O1EzVou+xSOmOaJBh07vovQJKjT+uShapjQWGaXvJYZe Rsi5KnS7OKvlAzW75GNXGhTCqBdLurLJDhmzCvzEkvjuDQj9cO4QdXHhFZ7fS8Myw7A== 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=Lhpz2WGX; 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 E8399606A334; Wed, 18 Nov 2026 18:16:54 +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=Lhpz2WGX 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=1795025814; b=1VzZbdz15rokYt9ZLniTVXmKnx1W2ScfFCUDDIg0KCYr4cAUvaGSRcPW5UaSl7dOPTBb 4Zg/06OwgCp0tZcgLCm42oV7Tvfqrz759d67D++nSvDmT+Lru7roGdP/vAFBeMJyeRvGr QQx7iSzjJibTZ6yFHHVAdgmy/EUfRwRBAvV1cSWGP1nV5HZZP6wHhOR9YEqu0Eny5OR6X cCiuL0xJMdCaWYhKanONWVp/KbmDwi79LaeMldqgm+3qha9OkoE1QUz56MTR9JSul60HJ teaILGH+zPDUhm+KQHgCadI3nSX04Ky7bUVhfHCJlokazX1kVNOtBLhyxl+GccGQc4Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795025814; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=8xIQBbs0SQnfnb2Q6EmYFwPaMd/Q9LTyn9jZVwWF/mk=; b=OmBIIDtpwdaxfH7IoEoVBVjImIY9+m/rzLm9pnmZNbYs3m0767yrDtlEKBpG9RTIflzL AtEit8lIZXHqrbkA/oX8WXuoUcJc/9j3XGYIUKr//P3+Wyeao1/cYZQ718Cnraxf8mPUN NCLmxhaquH1FCj1w17JSNsmPCCiFe9T6sDYCqWNeQHzi15uL3YmRKG3n9z7IZPVEGONmM H+8x3ZYlxu1zKOdIhHYc+BOiu84/7rDoO+XamCAU+339/k9UcS5qwHNCorw4lvyjooca9 eVcldv+EC4I3VwCmbTd530aeixOzSPbT6hOrNb7tS+8l8slwGgnhpDJt9bC8oPPClxg== 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=Lhpz2WGX; 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 1168A606A320; Wed, 18 Nov 2026 18:16:53 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 339AD1F000C5; Wed, 18 Nov 2026 18:16:52 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795025813; bh=8xIQBbs0SQnfnb2Q6EmYFwPaMd/Q9LTyn9jZVwWF/mk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Lhpz2WGXjwx+bqL/p+xO8CummT3MYCqm09s22/8rtMWvfP9Tl0avLQmxWvEn22fpW tuXe/dA3DZYVyFAugLG+cgMVTr/QaIafn56jOan4JMdqKSOHwkx4WGroR6aHZiGCAg sgLzfwbeRNhzaSjWa8b/sQEojjRat24+v/7CP0fuen0MXJVXFjkb3BM9AXWs/XSDoO OUn59AnyHAQJZ/bhi3+YRhLqB4iCKAvIPcJPZpBygq3YuH3cPdZNHgt4Of0KvJHWJl VQC/i36TmrcqFOX9juoEyFkRzaXI/zUph2QIUNOjUR+TAhbioEGQhVW855q4mWR1/S nJz/Qg9T2tF9A== X-Cc: netdev@vger.kernel.org, david@ixit.cz, edumazet@kernel.org, kuba@kernel.org, oe-linux-nfc@lists.linux.dev, linux-kernel@vger.kernel.org, pabeni@redhat.com, davem@davemloft.net 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 X-In-Reply-To: <20261112-nfc-v1-2-ab0ef166f382@gmail.com>