Netdev List
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: shyckless@gmail.com
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
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	[thread overview]
Message-ID: <20261118181650.GQ860048@horms.kernel.org> (raw)
In-Reply-To: <20261112-nfc-v1-2-ab0ef166f382@gmail.com>

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>


      reply	other threads:[~2026-11-18 18:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 10:04 [PATCH net 0/2] nfc: llcp: clone LSM attributes; st21nfca: fix skb leak Suyuan Wang via B4 Relay
2026-11-12 10:04 ` [PATCH net 1/2] nfc: llcp: Clone LSM attributes to newly created child sockets Suyuan Wang via B4 Relay
2026-11-18 18:16   ` Simon Horman
2026-11-12 10:04 ` [PATCH net 2/2] nfc: st21nfca: Free the ATR_REQ skb after sending it Suyuan Wang via B4 Relay
2026-11-18 18:16   ` Simon Horman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261118181650.GQ860048@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=david@ixit.cz \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oe-linux-nfc@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=shyckless@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox