From: netdev-bot+sashiko@kernel.org
To: luob87709@gmail.com
Cc: oe-linux-nfc@lists.linux.dev, johan@kernel.org, david@ixit.cz,
kuba@kernel.org, netdev@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 2/2] nfc: preserve NCI data status error codes
Date: Tue, 24 Nov 2026 06:55:21 +0000 [thread overview]
Message-ID: <179550332158.3135.4466298540445819272@kernel.org> (raw)
In-Reply-To: <20261123063310.1267-3-luob87709@gmail.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message leaves out the user-visible effect of the bug,
even though the patch is tagged Cc: stable.
--
nfc: preserve NCI data status error codes
This commit changes the status parameter of nci_add_rx_data_frag() from
__u8 to int. The negative errno returned by nci_to_errno() then reaches
the data exchange completion path without being truncated.
> nci_to_errno() returns negative errno values for nonzero data-status
> bytes. Passing that value to nci_add_rx_data_frag() through a __u8
> parameter truncates the errno and changes it to an unrelated positive
> value before the completion callback receives it.
[Severity: Low]
This isn't a bug in the code change. Since the patch is tagged for stable,
though, could the commit message say what userspace actually sees?
For frame-interface targets, nci_rx_data_packet() makes this call:
nci_add_rx_data_frag(ndev, skb, pbf, conn_id, nci_to_errno(status));
With the old __u8 parameter, -EPROTO (-71) became 185 and -ETIMEDOUT (-110)
became 146.
On raw NFC sockets, that positive err takes this path:
nci_data_exchange_complete()
rawsock_data_exchange_complete()
rawsock_report_error()
rawsock_report_error() then does this:
sk->sk_err = -err;
As a result, sk_err ends up negative (-185).
In __skb_try_recv_datagram(), sock_error() returns -sk_err, which is +185.
__skb_recv_datagram() stops retrying because the value is not -EAGAIN.
rawsock_recvmsg() then returns the value unchanged:
skb = skb_recv_datagram(sk, flags, &rc);
if (!skb)
return rc;
So before this patch, recvmsg() returns 185 and copies nothing, instead
of returning an error. With the patch applied it returns -EPROTO.
Would it help stable reviewers to add a sentence like this? "For example,
for raw NFC sockets this sets a negative sk_err, so recvmsg() returns a
bogus positive byte count with no data instead of an error."
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123063310.1267-1-luob87709%40gmail.com
prev parent reply other threads:[~2026-11-24 6:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 6:33 [PATCH v3 0/2] net/nfc: fix skb ownership and NCI status errors Bin Luo (University of Electronic Science and Technology of China)
2026-11-23 6:33 ` [PATCH v3 1/2] net/nfc: fix skb ownership on data exchange errors Bin Luo (University of Electronic Science and Technology of China)
2026-11-24 6:55 ` netdev-bot+sashiko
2026-11-23 6:33 ` [PATCH v3 2/2] nfc: preserve NCI data status error codes Bin Luo (University of Electronic Science and Technology of China)
2026-11-24 6:55 ` netdev-bot+sashiko [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=179550332158.3135.4466298540445819272@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=david@ixit.cz \
--cc=johan@kernel.org \
--cc=kuba@kernel.org \
--cc=luob87709@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=oe-linux-nfc@lists.linux.dev \
--cc=stable@vger.kernel.org \
/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