Article View: linux.kernel.netdev
Article #21564Re: [PATCH v3 2/2] nfc: preserve NCI data status error codes
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 06:55
Date: Tue, 24 Nov 2026 06:55
63 lines
9950 bytes
9950 bytes
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
Technical Details
Message-ID:
<179550332158.3135.4466298540445819272@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370059-linux-kernel-netdev=dewy.ruReferences:
<20261123063310.1267-3-luob87709@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370059-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v3 2/2] nfc: preserve NCI data status error codes Date: Tue, 24 Nov 2026 06:55:21 +0000 Organization: Usenet Network Message-ID: <179550332158.3135.4466298540445819272@kernel.org> References: <20261123063310.1267-3-luob87709@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="4073642"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:56Sjj8raHdgMkgwMn+PiDvbd4x8= sha256:AtLimU37moTiLfD5jqXg4tJ9KCYaZJ/qm1UVyf7WYs0= sha1:37AZbF5OuECnBU5f1cmfkTksWI0= sha256:E0B4W9ypW34PEwEeu0gqv9iDOBk+WwYF9UGXPoLAnc0= 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 748AD125DD3; Tue, 24 Nov 2026 09:55:45 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 3qeaGFAKLocd; Tue, 24 Nov 2026 09:55:42 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-370059-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 7330E125DD5; Tue, 24 Nov 2026 09:55:32 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id E89B02336D; Tue, 24 Nov 2026 06:55:29 +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=1795503328; b=dos4+ibtVnqB0f8uetzXAwVm/j9aVGJM8Un+JA0dxl1AxCdVsvBJfGdURlbLM14Dme14 gA3Vl3leFtlj5uuc5ovp4Iggl29EFCY3TUaL5+LnUXO78SmsRdMec4InSawuuIo+bMJrH IqBqbNJ63F18l/mbhhOvERZUUH1ma0bh2fPuRAwW9n0ejD/G+ZQfkFNMOigp8vE2csXxH 3nX7JXnmEcNqut5/oHikovoW3tQNjHtRQiBluxiPkgo8bxhK/NdLxtx+8KOEuC1m16BdH YE7VEtFw0aBkozi6BDz6KpQB2wAAq53zmxgDfv/HVCNQGe7s7vXa8UiVxzyR85BsEvQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795503328; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=TgMg8cnKeGaOn1fh1GwgmxkFpMpIpPJnVBjPPAyDeV4=; b=IUGQ0oOq8PK5SXxBMuT+gK6lrmyNg1+i0/paHFBP/2FIkDfZUjAiLoZzYV9YKlZaITWB eKOppwF6X1uOfQghTx7j882xSS8G+yOqSBn+cgBZIZ9ocXVCQEdpSBxfnHywAQha1yJzu C/wXCx3ymNannhaZXo7PuhBSK3X0BVfldUwbdP4WZOwcedZC3QU1aUfAGbh+gQK+SCrx4 FGVN/kmrOnDxtKOYC+HQ8C9VVRCIPi4pcDO7Fwn2WSiqEC6kfP0ghDixymaK6GbNIEFcq 5b3lAlOXLOsTlx+Mz30h3z2jIESrLafdqw/1f4OTrnJbqitKIuhItke9AARUao6I92w== 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=lqH+Z9Jh; 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 CE600606A32C; Tue, 24 Nov 2026 06:55:28 +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=lqH+Z9Jh 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=1795503323; b=fr+QAxBdnZuIbQ+V7fL1cLX/d0Ps1KGbuS/Ohhio8HpoY0Isw5dQFvees/yrpsHsTUW4 grPa3tXAWcRZwXSZs8WUPf8qt7zHpvXwzPslKhM4UbNgCqlTlyvDZahuS5/t9r5LTU0wm AfBRT8ZF0M8+OSw9YuHL5+ZZXq8o3Lk2NoJueE78ouQxOMeQ5LB5yeFH278Alj5kFn2h+ gCBVa/JIit7Emfmfh2q4elseBHYsHLgt52385+RqIGQDQNjLBdZ5yv61pB7/dnqA2zfzh m+DsmIuRMfs4MNhX57U/o6Nmi6UCePBYFaJzjHI4EFiNRx8Vs90xQ9LSKL9NihA3pYA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795503323; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=TgMg8cnKeGaOn1fh1GwgmxkFpMpIpPJnVBjPPAyDeV4=; b=EbwkjCyqOTtKy0UJQWLmuMZ0m8T979kWnhn/rmfGEf6fD6UK8IAdDkk/A8Qt5j1vlLUA nO5y0xU3odt+QwG/93Kl5nM+zEkF60KZ8j2rbiDkgErpj7iXvLQFLFvr0c8yr6BOwg07G P3KVMhK/vEBg7H+MDJSPFa5yZzB81Wu+SY48/aHLcYSRfe0tk05Hg8Z09oFSPAOs0bsfD cjSU+GM/HdEJV8TzvZnddlMr2qJsm8J6LdGHrj3M1aeEkCV87Yu2eU9j3zieZmjVTzVK0 3vrrRP95cB6rPzZVeOfSVkVgyYyA8AB0d3G6YbYYVyURBkBQx+xnEya7eZW0UWmcPBA== 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=lqH+Z9Jh; 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 EB578606A327; Tue, 24 Nov 2026 06:55:22 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 048251F000C6; Tue, 24 Nov 2026 06:55:21 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795503322; bh=TgMg8cnKeGaOn1fh1GwgmxkFpMpIpPJnVBjPPAyDeV4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=lqH+Z9JhrLkNuswKiOV3R+y4DNBmImUp/NHnyP7CrYx0LY+PLwPNQpb+CPMt6e1KS NB2brULf1cVw9zXR2DzuqJzrZPZDBtrJrIZzdj8ndEagseHmPa0Pk706n3nNQgS9F2 sNAfOO5QjbbaKms8t6eqyldkcuqiZUaE0zurQmj+1fUeHDVF9rbE/qQteK4W1/u4VM tVq4gCPscfxZ91M+/EzYOj/bo/511KMteFmKLjd1tgE4SBTd0iqCrwjStKxSD70jJL FPwO3UiLx3d52UtPrHjOr0MqvG3OgHIJFWtixUOaUn8mHYjZM7PGqpwBqLmjEum1NK ogWB8B//8wVNw== X-Cc: oe-linux-nfc@lists.linux.dev, johan@kernel.org, david@ixit.cz, kuba@kernel.org, netdev@vger.kernel.org, stable@vger.kernel.org X-In-Reply-To: <20261123063310.1267-3-luob87709@gmail.com> X-sashiko-severity: Low 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