mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lukas K." <kernel@0x83.eu>
To: Thorsten Leemhuis <regressions@leemhuis.info>,
	"Lukas K." <kernel@0x83.eu>,
	linux-kernel@vger.kernel.org, krzk@kernel.org
Cc: regressions@lists.linux.dev, netdev@vger.kernel.org,
	Michael Thalmeier <michael.thalmeier@hale.at>
Subject: Re: [REGRESSION] NFC broken on Thinkpad T14 Gen since 9c328f5
Date: Sat, 7 Feb 2026 01:25:29 +0100	[thread overview]
Message-ID: <d73ccfcf-507c-4c22-beeb-efc24f671626@0x83.eu> (raw)
In-Reply-To: <b82d8cc1-2124-417d-95f8-5fed429e2d0e@leemhuis.info>

On 06.02.26 17:24, Thorsten Leemhuis wrote:
> On 2/6/26 16:15, Lukas K. wrote:
>>
>> from 6.17.2 to 6.17.3, the integrated NFC reader (driver: nxp-nci_i2c)
>> in the Thinkpad T14 Gen 4 (AMD) stopped detecting tags. This can be
>> tested by running
>>
>> sudo nfctool -1 -p -d nfc0
>>
>> Looking at the commits between 6.17.2 and 6.17.3, 9c328f5 (net: nfc:
>> nci: Add parameter validation for packet data) was the only one related
>> to NFC.
>>
>> To see if that commit indeed was the culprit, I reverted it on 6.18.7
>> and nfctool is detecting tags again.
>>
>> Since the offending commit merely adds some bounds checks, the root
>> cause may very well be in another driver in the NFC stack.
> 
> Thx for the report. Seems Michael (now CCed) also ran into problems and
> tried to fix them, but looks like that effort stalled; but might be good
> to know if this fixes your problem, too:
> 
> https://lore.kernel.org/all/20260112124819.171028-1-michael.thalmeier@hale.at/

Hi Thorsten,

thanks for the pointer. Tried the patch you linked to and it works for me.

Don't know how to reply to the linked mail as I'm new to LKML, but one 
thing caught my eye:

 > static const __u8 *
 > nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
 >                                        struct 
rf_tech_specific_params_nfca_poll *nfca_poll,
 >-                                       const __u8 *data)
 >+                                       const __u8 *data, size_t data_len)
 > {
 >+       /* Check if we have enough data for sens_res (2 bytes) */
 >+       if (data_len < 2)
 >+               return ERR_PTR(-EINVAL);
 >+
 >        nfca_poll->sens_res = __le16_to_cpu(*((__le16 *)data));
 >        data += 2;
 >+       data_len -= 2;
 >+
 >+       /* Check if we have enough data for nfcid1_len (1 byte) */
 >+       if (data_len < 1)
 >+               return ERR_PTR(-EINVAL);

If data_len underflows at any point it'll wrap to some large value and 
the less than comparisons will yield an incorrect result. Using ssize_t 
should fix that.

Best Regards,

Lukas

  reply	other threads:[~2026-02-07  0:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 15:15 Lukas K.
2026-02-06 16:24 ` Thorsten Leemhuis
2026-02-07  0:25   ` Lukas K. [this message]
2026-02-07  0:38     ` Andrew Lunn
2026-02-18  0:21     ` Jakub Kicinski

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=d73ccfcf-507c-4c22-beeb-efc24f671626@0x83.eu \
    --to=kernel@0x83.eu \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.thalmeier@hale.at \
    --cc=netdev@vger.kernel.org \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®