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 B4B9F40DFA7; Sun, 12 Apr 2026 15:35:26 +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=1776008126; cv=none; b=TGNHpV305hyFyrbsZOZURW9y4PNLefo2FmSKAgQ7HDzYEnRr/DdaIztZmwklLsvE1LJElX4O82JRssHeTK773ov5IYuzywPtXgoUF4a4CyULfqcxOymn/IU+cY6XFCG0BEVn9uMThrB3Kl1zUYa/BeYzlRVTLJvYKL+6ikRUNAY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776008126; c=relaxed/simple; bh=5YsvttyngPGYtQHRbR3CxIzo+j2kGqpaD2R2KW1/pB4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dgI6MxW3x4eRlTdMrfjA/EEGQa8ijcYnl4TVtoEPgfd+TqWHnGN+3HMJdKoqjIy6UOBWND20JFpWF4DfJuuA5aR4+eyX99f2lCDd12IRfuivuprnU0GMOniZit9lwAYpu0LfweTsYpVS0LsIC5xFzAUlbS5VgjFElR7rWOcO5sg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mVdxTwSD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mVdxTwSD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEDEAC19424; Sun, 12 Apr 2026 15:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776008126; bh=5YsvttyngPGYtQHRbR3CxIzo+j2kGqpaD2R2KW1/pB4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mVdxTwSD9Wpl4ABfUV2s6te6KMgijk3kTCjJc1NOjpp809TpU6Hv/7oXUuFK3e4EX K7TH88Tu40sMTj/eZaOaN4G0/dANM0LnlmEpDpXAKnGpex64+k0j/0bESTwRkQoaxs EDZeFPtIZmI5K7As5vOyWMCtwYeC8O0fklsvvDfQh8VlG47/AkGEbiPqbtSpCJzvfY djOxBUjdmvUZvX960T9sSMjLLSIevVqY4kV8p29K6bwn/mPNfyld5vWlClmhO9+2IU OG14w9Zibknmb7BvZViZesy2MCdY9utRLipqOhE50WV8ibwUl4uH07UvxMaQgSwkUI CuqciGtyUMGPg== Date: Sun, 12 Apr 2026 08:35:25 -0700 From: Jakub Kicinski To: Pengpeng Hou Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Kees Cook , linux-kernel@vger.kernel.org Subject: Re: [PATCH net v2] NFC: digital: bound SENSF response copy into nfc_target Message-ID: <20260412083525.7bf26414@kernel.org> In-Reply-To: <20260407120004.4-nfc-sensf-v2-pengpeng@iscas.ac.cn> References: <20260322031922.57949-1-pengpeng@iscas.ac.cn> <20260407120004.4-nfc-sensf-v2-pengpeng@iscas.ac.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 7 Apr 2026 09:57:36 +0800 Pengpeng Hou wrote: > digital_in_recv_sensf_res() copies the received SENSF response into > struct nfc_target without bounding the copy to target.sensf_res. A full > on-wire digital_sensf_res is 19 bytes long, while nfc_target stores 18 > bytes, so oversized or full-length frames can overwrite adjacent stack > fields before digital_target_found() sees the target. > > Reject payloads larger than struct digital_sensf_res and clamp the copy > into target.sensf_res so valid 19-byte responses keep working while the > fixed destination buffer stays bounded. You need to solve the riddle why this driver thinks the response is 19 bytes but the core wants to store only 18... > Fixes: 8c0695e4998dd268ff2a05951961247b7e015651 ("NFC Digital: Add NFC-F technology support") nit: the hash in the Fixes tag should be only 12 chars -- pw-bot: cr