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 365CF480DCF; Tue, 25 Aug 2026 13:41:31 +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=1787665292; cv=none; b=mPi9TRFYRjjCRWh3zAVQk1VoeoFre6wfVrrU5zJEpj019gHLJrqivHbBhMGo7OF1stMvJfZbkRL3O10D0gi6M6CQxH8vIHHXtwywQThX0B9lqZpGt+LmdmTsVJiBLMGAoXcRYKVg/In/l21d6PkIAjouafvBl+dvcEqemj5lHCc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787665292; c=relaxed/simple; bh=q/D0c8Tp+ncbplTvBdLi+rzL3rb/IJmo+4YNdQgW0AI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HJ6ITHYGizTsPvFkLhQ00eqgytTcjzWuhpYyehH/FYzMEtyVPdJM578ectiIy0voRVBJ1hnBMPidGBc/r39/CZhZfL8RDnWxU5EQpwvDldenpjGDRgglfKu9JjO7w9nE/BUtp8QN6qbOm3n1TO6zh20hcxFb+RpqT/wkyRAIsg4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=q4KDb8iA; 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="q4KDb8iA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83CE71F000E9; Tue, 25 Aug 2026 13:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787665291; bh=SCa/Fy6NlD6ggcqsUvLlu8StrGYZr++KmegNCSZTgtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=q4KDb8iAGykWxupHyHKo0KGgJJCyEBlfaTX1Wc9m79P5Q16lZ68qjyW9bjkNCu7UK 7dmVhcyb6rnqAJTRTaCi5QL+jn90PMbc0y40vNuznbUlhvhdTj9W5DWe7gMjulcSfe qsoxD4H9v2NAjvgiTCh/dP8u0eI3fpNaq3p+O0aQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Doruk Tan Ozturk , Alexander Lobakin , David Heidelberg Subject: [PATCH 6.18 34/94] nfc: digital: clamp SENSF_RES length to the destination buffer Date: Tue, 25 Aug 2026 15:25:30 +0200 Message-ID: <20260825132543.249604995@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825132541.887883084@linuxfoundation.org> References: <20260825132541.887883084@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Doruk Tan Ozturk commit 344a56d7c8e0f3cbaff0bcb1bcd95a1a1db24b16 upstream. digital_in_recv_sensf_res() memcpy()s resp->len bytes from a remote NFC-F device response into the NFC_SENSF_RES_MAXSIZE-byte target.sensf_res field without an upper-bound check. A nearby malicious NFC-F device can send an oversized SENSF_RES response to overflow the stack-local struct nfc_target. Clamp resp->len to NFC_SENSF_RES_MAXSIZE before the copy. Found by 0sec automated security-research tooling (https://0sec.ai). Fixes: 8c0695e4998d ("NFC Digital: Add NFC-F technology support") Cc: stable@vger.kernel.org Signed-off-by: Doruk Tan Ozturk Reviewed-by: Alexander Lobakin Link: https://patch.msgid.link/20260603141355.68156-1-doruk@0sec.ai Signed-off-by: David Heidelberg Signed-off-by: Greg Kroah-Hartman --- net/nfc/digital_technology.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/nfc/digital_technology.c +++ b/net/nfc/digital_technology.c @@ -778,6 +778,8 @@ static void digital_in_recv_sensf_res(st sensf_res = (struct digital_sensf_res *)resp->data; + resp->len = min_t(unsigned int, resp->len, NFC_SENSF_RES_MAXSIZE); + memcpy(target.sensf_res, sensf_res, resp->len); target.sensf_res_len = resp->len;