Article View: linux.kernel.netdev
Article #6704Re: [PATCH] net: sparx5/lan969x: do not read past skb->len when injecting a frame
From: Simon Horman
Date: Fri, 23 Oct 2026 07:34
Date: Fri, 23 Oct 2026 07:34
25 lines
9113 bytes
9113 bytes
On Wed, Oct 21, 2026 at 01:25:33PM +0200, Daniel Machon wrote:
> > sparx5_inject() writes the frame to the injection FIFO one 32-bit word
> > at a time, and pads frames shorter than 60 bytes with zero words.
> >
> > Before this patch, the last word is loaded whole even when skb->len is
> > not a multiple of four, so 1 to 3 bytes past the end of the frame are
> > read. For a frame shorter than 60 bytes those bytes are also
> > transmitted, as VLD_BYTES marks the whole last word valid and the
> > padding starts at the next word.
> >
> > Write the trailing bytes from a zeroed word. The number of words written
> > and VLD_BYTES are unchanged.
> >
> > Found by an AI code review agent, and reproduced on lan969x and sparx5
> > with register injection: bytes 57 to 59 of a 57 byte frame were not
> > zero. With the fix they are zero, and traffic still passes on both
> > chips.
> >
> > Fixes: f3cad2611a77 ("net: sparx5: add hostmode with phylink support")
> > Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
>
> I somehow forgot to include the target tree. This one goes to net.
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261023073433.GG708417@horms.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-350945-linux-kernel-netdev=dewy.ruReferences:
<20261021-sparx5-inject-tail-bytes-v1-1-7dcc035c8ddf@microchip.com> <20261021112533.m6fh7xoqp74uevho@DEN-DL-M70577.microsemi.net>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-350945-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] net: sparx5/lan969x: do not read past skb->len when injecting a frame Date: Fri, 23 Oct 2026 08:34:33 +0100 Organization: Usenet Network Message-ID: <20261023073433.GG708417@horms.kernel.org> References: <20261021-sparx5-inject-tail-bytes-v1-1-7dcc035c8ddf@microchip.com> <20261021112533.m6fh7xoqp74uevho@DEN-DL-M70577.microsemi.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="438724"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:8dJT3f/84W1kXR7JPx0m8GBxwiQ= sha256:3fG5xN6qioxiB5VYAWOvBdIHSI+0Sw+69oQpwUi8FKA= sha1:mYtzz8NXqT4XDD8Sbg9u7w0W8aE= sha256:3IKKtX89GqqzoVjaJ3NFJUjqccysZ2+yGjUkTMIk06g= Content-Disposition: inline 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 E7999111420; Fri, 23 Oct 2026 10:35:08 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.839 X-Spam-Status: No, score=-3.839 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.339, 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 FmLhvKDEXUc9; Fri, 23 Oct 2026 10:35:06 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-350945-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 333AB11141C; Fri, 23 Oct 2026 10:34:57 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id CD29B60640E; Fri, 23 Oct 2026 07:34: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=1792740880; b=eqwbgvXMMmYF5tKi4QY1DAZ2pimaiT+EbIvNZYdWSx3JAZLOsL4+U5soefzw9XxIQHrN GTEaTveJ/RFYMMqnBjZEQa5JEr6taT8dVyA+jdWCEJbFggc4XnTLBd8BWDfuTtJvM7izC 177OR6sKDvyfxZxnDNwQbdx27L0exSA0DZT0H9KMcxuwRQaS8GsB1qOHVoY1DrXDQUK97 8PStB9EKNsso90pQhfEhNl+lPCfYTm3wEsEFCff+eapkKJKjxt0GRPuXe2VcJRcda9oKh +2BnhhdbY5uW1R0jmgRYCM7icU/DkevXEuqE1Xb09RDsM6u6cmUZ9vmFfE3Rkk6sbuQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792740880; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=OIX7l9JSAlMqQr0Ju+ts9cEQxL6n0uf9RUiDDUXeVNk=; b=1302F2D/fgAm/jg0gW+f6R68rehz8+0ZtM7ZhS2fzK3yjw+f1/MOWAlY9ayXdRb5Quj2 ERxtUb2uYKf2dGU2gD8tVslItSOx3Pg0DEbEvprT+K3zgl8Ss5ItSSEK/UQ3ycNYgGLbm 3RMM4nKb9xt6wEucF7ew/E0ANJrG23JrNmtQF1JQLXvheya+jgD4NYKNbi4aObn5QYRZJ EkS3pudkY4g1Am6XVnjWCUwzJds1x6fTIqLxd3ojIeQU4t4XNNzrZ7A++46DpLBwkR48n GjF3g69Mp6BxQi5q9wvVuDej6PJ0rdCu4AIbH7rPq3Xii37kcQvoA+o5uCk0LRLv+yw== 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=ct3RZzN4; 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 F3042606A333; Fri, 23 Oct 2026 07:34:39 +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=ct3RZzN4 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=1792740879; b=IZMWjpVWTkGY+h9EpPBdRq34PqYnCEKty1FsupvG0bvvKy9OQiqPUSY6N/iwi+oCAHgU +lQNHbFBlqkNJcPUZVWGrv6jjPWw5KcWpowceuubi+1Nh41SYnsRa7ipbxeCRDlBAvvaF V1CmJu4VNbNt4jOBFnuS4sQYJRWMJ9ot0PM9f6CxVUvuiv1cKbGeubSO8hzhTSh2Ejpvo gE9C9XzgUMm3bvZ/cuhUIWXWAXuB7jQOmcAd5rEjGRzDBYSvBC+i8QYQxfLhzRs1goqCe UjIX57FV6p79yY2osQTUgVlWlCegrncbthg9QoPgbEvOnNoY4K8vnTl8bMiMTTgZdsw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792740879; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=OIX7l9JSAlMqQr0Ju+ts9cEQxL6n0uf9RUiDDUXeVNk=; b=Ch4Y87cNXJ4hw7QPmdcftMkH0pNrYUNN/Np81LDnxgU1WArV87L34H+ae+R6Db9D4PfN f1YDzWtsgcT9JwXvIipuYQoRKFTDc1oOe2/ALWJ+eR2U5Lr1RM7XcSn/ymNNAo6lpbGCZ GSKzXOrm97kBlQZAwbci/w/uPXOWTU9YrwSY6Hoqaw0F2Xs2ZDJSGhteqYv0D8U63ue+V nR4zUmrzMAk8U0WAC05YZjw5BLz7AwIjZL/FgkoJaqnCW8K6Rdjqh/EAeSM2Db8p/S6SM TmICmoncJeJr+RvKprzkOTP1f8OM4cJbN+pFMm67aLkLKtC9Lu0QLK0kSqq+SevHCAQ== 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=ct3RZzN4; 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 D61D2606A328; Fri, 23 Oct 2026 07:34:38 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33E3E1F01828; Fri, 23 Oct 2026 07:34:36 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792740878; bh=OIX7l9JSAlMqQr0Ju+ts9cEQxL6n0uf9RUiDDUXeVNk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ct3RZzN4FJzAgCV52jbDVDNq9GVv8I51XFFJHPXlHaFYSdf36kkOA5pWMm9a6Twnt moism0coMV3XQTlXilR3+WnBaYjky98vNdZeH9T+VYV4NDmnKNoLl7BKOl3C5Xgvdr xXnZRnhRvap+mS/jSkfMbC/4ld0F90kOYqOCTiTbuDn75BRT5KrT8sdEaXi5XYcgLJ GIaiNccrKFRrgs2tHq2Rx5sly+0lGsa/tkkGUy16qXyv/mWv4dUtAUfSl19Eiit8Nr JwcnEkQsKulvCRRSoOzy9yrTp37ptNuJuJW5WlKfAIFDuV4ozP2YAQEM+K1aSX76e+ NF1dRo6+GdNtw== X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Steen Hegelund <Steen.Hegelund@microchip.com>, UNGLinuxDriver@microchip.com, Bjarni Jonasson <bjarni.jonasson@microchip.com>, Lars Povlsen <lars.povlsen@microchip.com>, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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 X-In-Reply-To: <20261021112533.m6fh7xoqp74uevho@DEN-DL-M70577.microsemi.net>