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 9E0F9409265; Tue, 25 Aug 2026 13:53:02 +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=1787665983; cv=none; b=mnq77k1+tI9Js/z07IoGB5z19oMwPZ3L4aycGdRSvch+wN+T3VaggfwlK/H/N7wuZC8c9w3Jw+OeVCpEmhgCbfzHdQ5sejWPRmqyBR0XD+0hXslv2vbNCJ0KoYBQzXgBlxns/Qus8ri1no5UK0ys1Y1rHKcIy2bdzoZk+trZZTo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787665983; c=relaxed/simple; bh=463zu0cevTJZykDww7bFZTjtrC2AbyetjgvHgC/4KDw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X3FTTEiOVeirBc2+QvbF5eZ6oJzsS2DZxG/ioVdiM9gGiSbHwLf0vYaXKi/KwCbqpNdT1p9CeFOkaZMo8mSMeqd/CjhsDX5k8IfTmmlzxxlp9QXHolUXYKrsaJhC/hybZJC1qosw91KG5s2dKVBWn+VfT1AP21qgqs53y82+7+E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JawqUlEW; 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="JawqUlEW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F109F1F000E9; Tue, 25 Aug 2026 13:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787665982; bh=r2hBR0+R9kfsOg5+DZW7awRk+cOpkV43mmVHGMMZs+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JawqUlEW7hedsc2qojcU+102N8wugDB5PYHJW2ljkY3aON9fySUW3tVQwP1OuGCHa TX0zxy2aWofjhABQhr4RGMSv/qnj9V8cDFHxxl2924UNC2VVoayr72a8wBuwA+kWn8 NbJrkbZEILKqqzzH3XYTd2upwhcv9ilQtHY2dmeI= 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.1 42/79] nfc: digital: clamp SENSF_RES length to the destination buffer Date: Tue, 25 Aug 2026 15:26:22 +0200 Message-ID: <20260825132543.354774115@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825132541.677185791@linuxfoundation.org> References: <20260825132541.677185791@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: 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;