🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5643

Re: [PATCH net v2] net: prestera: avoid overreading a short firmware tail

#5643
From: Jakub Kicinski
Date: Tue, 20 Oct 2026 19:02
17 lines
8564 bytes
On Wed, 14 Oct 2026 11:25:40 +0800 Pengpeng Hou wrote:
> prestera_ldr_fw_send() passes complete 1024-byte blocks to the loader
> and then sends fw_size - pos as the final chunk. Firmware header validation
> does not require the payload size to be a multiple of four. Consequently
> that last chunk can end with one to three bytes, while prestera_ldr_send()
> still loads a full u32 from it and transfers bytes beyond the supplied
> firmware image to the device.
> 
> Reserve space for the rounded-up transfer, use unaligned-safe full-word
> loads, and construct the final word from only the remaining bytes with
> zero padding. The firmware image-size register still describes the exact
> payload size. Preserve the existing native-word load and writel_relaxed()
> byte-order convention.

Sounds like well formed image should not require such writes,
so why not reject such send calls as an error?
Technical Details
Message-ID: <20261020120236.56f680c3@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349478-linux-kernel-netdev=dewy.ru
References: <20261014032540.14311-1-hppiscas@163.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349478-linux-kernel-netdev=dewy.ru
From: kuba@kernel.org (Jakub Kicinski)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2] net: prestera: avoid overreading a short
 firmware tail
Date: Tue, 20 Oct 2026 12:02:36 -0700
Organization: Usenet Network
Message-ID: <20261020120236.56f680c3@kernel.org>
References: <20261014032540.14311-1-hppiscas@163.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3930630"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Qa5m/QZShTriPPma4Dpop2iwJDU= sha256:SkFpVNEqBUMm5bNMeyYJRGfuZ7uKSr3s7nncYgJ81sk=
	sha1:nDNoR+xrUTcvRrjFkkKBdEZ+EO8= sha256:zIgtWWFMzysOh+cL4NTxTB1q2Uy8Q76fL99+OfPYJDU=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 525CA110DE7; Tue, 20 Oct 2026 22:08:40 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.729
X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id W1MXCYEsz3Xl;
	Tue, 20 Oct 2026 22:08:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-349478-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 8C522110DE2; Tue, 20 Oct 2026 22:08:29 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7BB6433616; Tue, 20 Oct 2026 19:02:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792522963;
	b=2COSzS93j2iCoCOV0YkYEbqEaJDgoWI2xI+OrsgBJBVltzguxaCsl71QEC8tujOlBJOp
	 Fxuh2+wjbtM7vbS5X2nX0fDwRs4qp1fU+0K9GvvoWVZ1alhQAFRbApa7cy19igc+moktU
	 tCKY5+w3wj2/W4nleCQ3y0Jn5tK+543+WuVNOX31vT3O17OrNPQhBaYuMlRG/r9yxrrSA
	 WWrPFIhfXhobioLub713cSq2aQh50We7M37ChfQDlRSqX/4q4OXT745UIVTKMLJlcU9p0
	 pDhrm4cf5cNDGFGI5OEGFXGTVvLahG4KGTy+dyyvA5+yWM9oKCyZpRl3zBpZP0pCe9g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792522963;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:In-Reply-To:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=rW/jACDVaEyqKtByUIED15cmwLmekwhz+6PLjSz/DjA=;
	b=1edgSMihQl3n9Kfxbjx5WOvmFLcW2B07MubIL5j00raEwswRdzHC47ZP31V39u5E6mVj
	 CH4Daoqrg6+OEKouMDivOmzoK9DOn4l2K1OQrQZ+2EWrlJTeXFTqC64eui7OOq536hst9
	 /kgWvTYJUA7pRHyeTElE/Zt+3+XdSF0U4hzuzHjGuf3j92bEeIOQvDi/FZTTC0BGvSAs8
	 vH/YNrhQAbbszKesFi9IQmANUKn3HUWTfM1zhV7t6SCl9Lg2Dmsejl0Y7OEhtEzpJNNqm
	 x7c+QWPZroyfRxQC7uLAZoJKgSQGwaheFIWp2HwNzEEsFAqDTRTPQICxZTpFRBeJl9A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XUO4nI+T;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 510C1606A32C;
	Tue, 20 Oct 2026 19:02:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XUO4nI+T
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792522957;
	b=QwQgTL2ry5ye+V/eCNTfATESQfslBSUoRI1N4PV8hksLf9YQ1wr0fLcqzWVgf7h9xTpP
	 uo5p4j7cgxHYvZwle53kUex9bchiZzy7rf2+N4hhxFSvgD8I7f0hcbzLR75jTHaUo9hMv
	 PnNPj+jjYqA6mkv/glxDyIHnUZTNFAxs//mPNpBlF4+tP4TSYe9/+/F8dSpgJ4VIN1wjo
	 IcG0U7utBEAS7yHZ68hJPhYoR5SAw6Mjpsens70YT1KJqZB+F1ee8pU7yJXZGTNwSrUrF
	 hZNVokqvkJRWKXUkj5qY51RzOwlNLeaUC45bV5sZ139Mqdj8PMixtgfIIqULyL2Uv4g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792522957;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=rW/jACDVaEyqKtByUIED15cmwLmekwhz+6PLjSz/DjA=;
	b=2iO5CtfCwQg86w36RByfu4WFFpkNWQ1BcMFO779juH10yl/hR6q5IO21oOS7I+IUoyKy
	 fcxAH8rFPXurRtxkg1Ldu5obn2tx5bpi7AFVNOMn/tY5gtq9CqpOGfWZfCILSON1u3ITZ
	 /HPKWZ8sTQlVtmPXmdFhrQRZgS3uzDbV0nQ/tWYEh2vQuwMVb/NEurOr+K2MThn/wM1u8
	 DbItm4qAAta/ivXkwM1cCvhBFEYc5MPskI68HKKfyWaTXK0TvqCRcfYkR87Z7NoHR4q7m
	 4/IX4WgA5v42CxhG5Ln2o8zko5ymm2DfFta0flwfMBtV8pR9Y9gC61OXnVZVG9G4+Ow==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XUO4nI+T;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3667E606A319;
	Tue, 20 Oct 2026 19:02:36 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D0BD1F000C9;
	Tue, 20 Oct 2026 19:02:36 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792522956;
	bh=rW/jACDVaEyqKtByUIED15cmwLmekwhz+6PLjSz/DjA=;
	h=Date:From:To:Cc:Subject:In-Reply-To:References;
	b=XUO4nI+Te2i5KM8qqTYtd/L+cznicBaVPwwEp5BgGNSIdKDMRTXE5GCh8ZPi14K9j
	 735dKLZ9y97zLOSo89SwFO5UZWimzUTMeocRnpsZWOi3HNMFZ5qMar9xaNCekoQn0l
	 cyehfFvvAx9MCC3lttBA+PDO4AHi7XJaCBQsXbGrMuqGMxDpF4Hi2sJekj5z8bDJ7S
	 NvHCDesc0VD5gBTpF8lyDmCDctmiEw9o5Y6zu63CAhigXHUBx0T2K0Ibk1fyC9dV9a
	 +FC2V1B/lFigXXgKvx6nUBI+6f2u4/KKfHvL4+z4C/npeKpgYTkymVBHXkpvRLfAp2
	 fA/yTdu77s9JQ==
X-Cc: Elad Nachman <enachman@marvell.com>, Andrew Lunn
 <andrew+netdev@lunn.ch>, "David S . Miller" <davem@davemloft.net>, Eric
 Dumazet <edumazet@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261014032540.14311-1-hppiscas@163.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list