From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A70730F52B; Mon, 13 Apr 2026 16:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776098676; cv=none; b=pfVJVaLu1+bJog0o0i4AXixhd2rjKFPGWqBG8hXwFa1YVD3RQIZAkgcCvr+C4JfDgsZaVkdE9gMDVFJfe5zcZ/ANhuHbjGZ1P4iZdZL/n40D79wqQPPR97R1WV6GFjHijWDm/ljHJQehhQ8pHqAIWUJ1aruX+4Bpo2IeIs2ujZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776098676; c=relaxed/simple; bh=RYuiDmMg3E6lbfrLZPdQt0AgnbVGcXvolmrjL+A/MIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RP0iierHAAjFJGl30APPkx4ssz109JrDtnJurltYfH+znUj5ujaGkDsei9HKCIYMD+HqRwEAX3qLwOoUNtxpPYFxWRfFdy6ybIr0MQM215N6ObeLYEW1GA5/KWjJX+3bckaF2ZCRB/N6SCNzTCtQxP1L4shp0eqIXneKaanG138= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=e/aFSwAY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="e/aFSwAY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB517C2BCB3; Mon, 13 Apr 2026 16:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776098676; bh=RYuiDmMg3E6lbfrLZPdQt0AgnbVGcXvolmrjL+A/MIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e/aFSwAY8bxetTW7U7c5mBNriIm9ySQo4HuYdEv/sLmAGYDZ50RpIaYkyiumLOz1x MeiLcwPHyli1gffvmIDNVsN1lhRXOBVeZHDDl3xE4cJWt6s2c5BYa3cGJ3EhsDbf8N F+u9/cpvDTuPz9Hbg4kGUwWMXAo2Won+xalER4Ew= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ian Ray , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 046/491] net: nfc: nci: Fix zero-length proprietary notifications Date: Mon, 13 Apr 2026 17:54:51 +0200 Message-ID: <20260413155820.777159230@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260413155819.042779211@linuxfoundation.org> References: <20260413155819.042779211@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ian Ray [ Upstream commit f7d92f11bd33a6eb49c7c812255ef4ab13681f0f ] NCI NFC controllers may have proprietary OIDs with zero-length payload. One example is: drivers/nfc/nxp-nci/core.c, NXP_NCI_RF_TXLDO_ERROR_NTF. Allow a zero length payload in proprietary notifications *only*. Before: -- >8 -- kernel: nci: nci_recv_frame: len 3 -- >8 -- After: -- >8 -- kernel: nci: nci_recv_frame: len 3 kernel: nci: nci_ntf_packet: NCI RX: MT=ntf, PBF=0, GID=0x1, OID=0x23, plen=0 kernel: nci: nci_ntf_packet: unknown ntf opcode 0x123 kernel: nfc nfc0: NFC: RF transmitter couldn't start. Bad power and/or configuration? -- >8 -- After fixing the hardware: -- >8 -- kernel: nci: nci_recv_frame: len 27 kernel: nci: nci_ntf_packet: NCI RX: MT=ntf, PBF=0, GID=0x1, OID=0x5, plen=24 kernel: nci: nci_rf_intf_activated_ntf_packet: rf_discovery_id 1 -- >8 -- Fixes: d24b03535e5e ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet") Signed-off-by: Ian Ray Link: https://patch.msgid.link/20260302163238.140576-1-ian.ray@gehealthcare.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/nfc/nci/core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 3514686eb53f9..188677c322f4c 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -1460,10 +1460,20 @@ static bool nci_valid_size(struct sk_buff *skb) BUILD_BUG_ON(NCI_CTRL_HDR_SIZE != NCI_DATA_HDR_SIZE); if (skb->len < hdr_size || - !nci_plen(skb->data) || skb->len < hdr_size + nci_plen(skb->data)) { return false; } + + if (!nci_plen(skb->data)) { + /* Allow zero length in proprietary notifications (0x20 - 0x3F). */ + if (nci_opcode_oid(nci_opcode(skb->data)) >= 0x20 && + nci_mt(skb->data) == NCI_MT_NTF_PKT) + return true; + + /* Disallow zero length otherwise. */ + return false; + } + return true; } -- 2.51.0