Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D68B947DD5F; Sat, 12 Sep 2026 13:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789218289; cv=none; b=s8hkwc8e7UAR3EjBFYjNFEtnlUy8lNzta/NHTt0EvnL6SK6w6UtqVdi9schhEhaTYrSc6k+JnIWpyaWQ0cK51V+H14Wk2wlhwOZeeUKBQQUQeOcQGhP4FV8qCywZbFIrGVBrOYMJawn80jlN9TEKrlEqMBWjM+ntcP0GZoIhmbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789218289; c=relaxed/simple; bh=hSFVxHkBpEJ3/RTNIOIf2rza7xXHvgFc+zV4HD1O62c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ICHj/hvBu8utZGlaVSpalbPLHaoQ2/6B13F0MuNWnmvhO5QJArxK5+0pzLI4f+RH3uWgbsi64fzyF9nUENA03kjGvqotzYAwnrruFUQlc+9bok/3C5lXvmFaN6ZWGXRx/KIxCdURnhcdto6JbDdtkjyGEuWueeNG6tt3zVJo+JU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oT5ICZl+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="oT5ICZl+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 948901F000FF; Sat, 12 Sep 2026 13:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789218284; bh=UcuPYTzb5+vDyNKDDGmrja7VlY6Wknosd33CbRwAfHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oT5ICZl++Z9PjXdmKwG7TcAVz3kSpzrSWu8fpDjft9rEYjFnJfe9jJZdea0A41uoQ ro/HHGks6o0FHo0Qm+7WZCZlYq3QGcVFr7y/MY5A+ZxX2hMPAHC5S4qUBQ+vBpdjEb 6156f37XP6T1jUdn9yv/JMziBeXLQqVa/DZydVCk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Linmao Li , Przemek Kitszel , David Heidelberg , Sasha Levin Subject: [PATCH 6.12 1070/1376] nfc: digital: Do not dump a NULL response in command completion Date: Sat, 12 Sep 2026 08:58:16 +0200 Message-ID: <20260912065631.408220906@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linmao Li [ Upstream commit 1c7dd70c0adfa58fd66b5cbd03efb747ad6d8d8d ] digital_wq_cmd_complete() dumps the response data whenever cmd->resp is not an error pointer. However, a driver can legitimately complete a command with no response skb at all. digital_tg_send_psl_res() is the only caller that passes timeout=0, meaning no response is expected once the command has been transmitted. On that path trf7970a completes the command with trf->rx_skb = ERR_PTR(0); which evaluates to NULL. IS_ERR(NULL) is false, so the NULL response passes the !IS_ERR() check and cmd->resp->data and cmd->resp->len are dereferenced whenever the debug print site is enabled. The driver guards its own dump with "trf->rx_skb && !IS_ERR(trf->rx_skb)"; the digital layer is missing the NULL half of that test. Use IS_ERR_OR_NULL() so that NULL responses are skipped as well. The callback on that path, digital_tg_send_psl_res_complete(), never dereferences resp and dev_kfree_skb() accepts NULL, so only the debug dump needs fixing. Fixes: 59ee2361c924 ("NFC Digital: Implement driver commands mechanism") Signed-off-by: Linmao Li Reviewed-by: Przemek Kitszel Link: https://patch.msgid.link/20260710061254.80975-1-lilinmao@kylinos.cn Signed-off-by: David Heidelberg Signed-off-by: Sasha Levin --- net/nfc/digital_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c index dae378f1d52b6..b180212532243 100644 --- a/net/nfc/digital_core.c +++ b/net/nfc/digital_core.c @@ -127,7 +127,7 @@ static void digital_wq_cmd_complete(struct work_struct *work) mutex_unlock(&ddev->cmd_lock); - if (!IS_ERR(cmd->resp)) + if (!IS_ERR_OR_NULL(cmd->resp)) print_hex_dump_debug("DIGITAL RX: ", DUMP_PREFIX_NONE, 16, 1, cmd->resp->data, cmd->resp->len, false); -- 2.53.0