From mboxrd@z Thu Jan 1 00:00:00 1970 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 79B8E1DA62E; Sat, 12 Sep 2026 16:41:51 +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=1789231312; cv=none; b=nnZgCQH+jSzm078Hx3GbuRo6YzosamB3jwb24xGLiWJD2ii8nVEce9QIajrO4eHSHxagpdrgu54+H9Nzf4PZkCeyb7Yq8c2HZaLgsdbfw3zLNAHPMalLCB0383pd2rTz7OaYiU/cT6zvWyefubKQRu4o+dzwNQ8fi/GruG1l4z4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789231312; c=relaxed/simple; bh=KfuulosvNjpdziOEh/CorVg+Gc36B49hymIPJaWntYg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d7+yEOr5nIZ+o6oUU68LGpheUqxtKr7d2IWm97RcuyDhUxmbDwKxFPxJabpoPmh4ov5DrbmNhdUlapGCv5GQC/2C341iFbXar3Ah8NYx9czlcFLrdJt3pBC3xzF93XgSWMEkldhGpZeyqAKXD3pyFF/dCR2vqbY2nL91QQC0Jmg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=G+tbti/u; 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="G+tbti/u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C3E61F000FF; Sat, 12 Sep 2026 16:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789231311; bh=BGuO2U/8Mn5kDnb5ThO01EdVmE9bsNztfVoesj5D2Sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=G+tbti/uLgN6sNSZT8ocr/w8D4vVCkVzzabI12Vnx6an65IsjAwHoNtLGoJYsDAwu l6Pc6fgk6JjxdKdnsVmNh7B5T/AjgQRuJEks6szHLYC3cAw5V6N3rMITOaFrcYitgg SuB7QlTMVA7q9jQ9LJnYvigpVrqRc68ol31VzTuI= 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.1 0966/1191] nfc: digital: Do not dump a NULL response in command completion Date: Sat, 12 Sep 2026 09:01:34 +0200 Message-ID: <20260912065609.914671638@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065548.086904252@linuxfoundation.org> References: <20260912065548.086904252@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.1-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 d63d2e5dc60c9..a6cf04cedd50a 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