All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ren Wei <weir@nebusec.ai>
To: oe-linux-nfc@lists.linux.dev, netdev@vger.kernel.org, horms@kernel.org
Cc: david@ixit.cz, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, error27@gmail.com,
	kees@kernel.org, pengpeng@iscas.ac.cn, raoxu@uniontech.com,
	rosenp@gmail.com, dddddd@hust.edu.cn, joe@dama.to,
	ian.ray@gehealthcare.com, kuniyu@google.com, linma@zju.edu.cn,
	vega@nebusec.ai, rakukuip@gmail.com, weir@nebusec.ai
Subject: [PATCH net v2 0/1] net: nfc: Fix use-after-free in general bytes retrieval
Date: Tue,  1 Sep 2026 22:47:31 +0800	[thread overview]
Message-ID: <cover.1788157545.git.rakukuip@gmail.com> (raw)

From: Luxiao Xu <rakukuip@gmail.com>

Hi,

This patch fixes a use-after-free (UAF) bug in nfc_get_local_general_bytes()
where the local structure could be freed prematurely by nfc_llcp_local_put()
before the returned pointer was accessed by callers.

The fix refactors nfc_llcp_general_bytes() and nfc_get_local_general_bytes()
to accept a caller-provided destination buffer and copies the general bytes
safely before decrementing the reference count.

Changes in v2:
 - Fix GCC -Waddress compiler warning in nfc_llcp_general_bytes() by removing
   the redundant nullness check on 'local->gb' array.
 - Fix line wrap indentation and column width across modified driver files to
   conform to the 80-column limit.
v1 Link: https://lore.kernel.org/netdev/cover.1786029423.git.rakukuip@gmail.com/

Thanks,
Ren
Luxiao Xu

Luxiao Xu (1):
  net: nfc: fix use-after-free in nfc_get_local_general_bytes

 drivers/nfc/microread/microread.c |  6 +++---
 drivers/nfc/pn533/pn533.c         | 14 ++++++++------
 drivers/nfc/pn533/pn533.h         |  2 +-
 drivers/nfc/pn544/pn544.c         |  7 +++----
 drivers/nfc/st21nfca/core.c       |  8 ++++----
 include/net/nfc/hci.h             |  2 +-
 include/net/nfc/nfc.h             |  3 ++-
 net/nfc/core.c                    | 15 +++++++--------
 net/nfc/digital_dep.c             |  8 ++++----
 net/nfc/llcp_core.c               | 17 +++++++++++++----
 net/nfc/nci/core.c                | 16 +++++++---------
 net/nfc/nfc.h                     |  3 ++-
 12 files changed, 55 insertions(+), 46 deletions(-)

-- 
2.43.0

             reply	other threads:[~2026-09-01 14:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 14:47 Ren Wei [this message]
2026-09-01 14:47 ` [PATCH net v2 1/1] net: nfc: fix use-after-free in nfc_get_local_general_bytes Ren Wei
2026-09-05 15:29   ` Simon Horman

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=cover.1788157545.git.rakukuip@gmail.com \
    --to=weir@nebusec.ai \
    --cc=davem@davemloft.net \
    --cc=david@ixit.cz \
    --cc=dddddd@hust.edu.cn \
    --cc=edumazet@google.com \
    --cc=error27@gmail.com \
    --cc=horms@kernel.org \
    --cc=ian.ray@gehealthcare.com \
    --cc=joe@dama.to \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linma@zju.edu.cn \
    --cc=netdev@vger.kernel.org \
    --cc=oe-linux-nfc@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=pengpeng@iscas.ac.cn \
    --cc=rakukuip@gmail.com \
    --cc=raoxu@uniontech.com \
    --cc=rosenp@gmail.com \
    --cc=vega@nebusec.ai \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.