Article View: linux.kernel.netdev
Article #5625Re: [PATCH net] net: axienet: don't advance the TX ring head before the descriptor is ready
From: Simon Horman
Date: Tue, 20 Oct 2026 18:55
Date: Tue, 20 Oct 2026 18:55
34 lines
9597 bytes
9597 bytes
On Tue, Oct 13, 2026 at 06:25:06PM +0000, Josef Bacik wrote:
> axienet_start_xmit_dmaengine() bumps lp->tx_ring_head before
> skb_to_sgvec(), dma_map_sg() and device_prep_slave_sg(), and none of
> their error paths undo it. The skb is freed and nothing is submitted,
> but the slot stays claimed. axienet_dma_tx_cb() walks tx_ring_tail
> once per completion, so the next completion lands on the abandoned slot
> and dereferences whatever skb pointer is left there: NULL if the slot
> was never used or was already completed, or a stale skb that gets
> consumed a second time. Every completion after that is accounted
> against the wrong slot.
>
> dma_map_sg() and device_prep_slave_sg() can fail at runtime, and so can
> skb_to_sgvec() on a malformed skb. Only advance tx_ring_head once
> those have succeeded. The completion callback can't run before
> dmaengine_submit(), so claiming the slot just before that is fine.
>
> dmaengine_submit() itself can also fail on xilinx_dma after a channel
> error, and its return isn't checked either. That's a separate problem
> and isn't changed here.
>
> This was found by the Sashiko AI review of the skbuff BUG_ON() series.
>
> Fixes: 6a91b846af85 ("net: axienet: Introduce dmaengine support")
> Link: https://lore.kernel.org/all/20261007-b4-skbuff-bug-on-v2-0-b9a5f732895b@toxicpanda.com/
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
> Compile-tested only, I don't have the hardware. The bug is in the error
> paths, which are easy to see from the diff: every goto after the old
> increment returns without submitting anything.
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261020185536.GR503057@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-349465-linux-kernel-netdev=dewy.ruReferences:
<20261013-b4-axienet-dmaengine-ring-head-v1-1-7add24e74477@toxicpanda.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-349465-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: axienet: don't advance the TX ring head before the descriptor is ready Date: Tue, 20 Oct 2026 19:55:36 +0100 Organization: Usenet Network Message-ID: <20261020185536.GR503057@horms.kernel.org> References: <20261013-b4-axienet-dmaengine-ring-head-v1-1-7add24e74477@toxicpanda.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3926943"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:FX+CIn8R3WkjibmSiTzW+ZkjCBY= sha256:h98Yl4fTdNJTdwb4uXytDJqdoslS5hiNMHCbx12PKwE= sha1:JSG0E4OmS4g7SNmUR0ohqT3z+ro= sha256:mzZq9Ir3Lw1SnVd+IBXAcCDpUA5HwYjqUFmv48SyFyA= 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 B2B1B110DD3; Tue, 20 Oct 2026 21:56:44 +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 CADPt-pLuXWm; Tue, 20 Oct 2026 21:56:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-349465-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 7EDB7110DCE; Tue, 20 Oct 2026 21:56:30 +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 6366C2CB52; Tue, 20 Oct 2026 18:55:48 +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=1792522548; b=2wmWfw3v9nJESv8UnTCRx2mv5uus5sBWOvp50GxZbBnxP6HDOUtUNtOILZ8PUlinU8wb EqfYJDiHk6XcadcAXQTUgu8o8+cuSoiooF5sVMOSw2GRHwnr/sZQ5cDwhFg6UQgkAk/k3 9VedEVEU3iOOvYn9O3JcYBpG0j6L/gFNGFoW+g1Cw8yjV2uhJQFPUYugPR1hkoDRrx4LO KAtz0pnfuPXssOK+Et55PB4qJUtaW+VWT8doIl2nq5RgIxo1agxdLFE4XYQaL66cA4Kru O/jfhLTkCxhtxl0m3W3qoY9HzNJcwAHw6cdxQkNRXaBAbiTA0EkpMQDt8gF/N5UyefQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792522548; 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=4PK2lzk2mI4nQc8YfV5A1vWK0eiPo0oKUX3U4tb8dEk=; b=Io3hAWge7WTm3FFNCT9E7jsGVBGOwQ5ilLfm/jQCkai6ZCkLGWNKi2hetlCCbnR0i/gv xOoVuEfueMd2uGOCharVLmiFPsQTNvXAS/+9eq9dtC7t/W2vIXu3cn7V6EVsDrRrjUWzc zlv1sF0UcGVCaBtDT7KhsgcpBqKnfbKuZtPWVVdagfMvYyTyv122wrrKGtfLcBXLzebil gNtQrQ3fED7GgY9ozdYC5xWSZvgl9my7HNgDZTzM/zSdyB6ZcawbkWz/Tmwz+qA3vgZC8 ctMfTXqVS+5j51M6E6vbtdv5cDzp5migZ9fgx9WZPhr9/ONFSIyhHEKtRXGfUMH4qmQ== 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=ixrA1YXo; 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 37D78606A321; Tue, 20 Oct 2026 18:55:48 +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=ixrA1YXo 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=1792522541; b=dO1Tw+DKgk15SFMAYNy+JS850hW6ZpEynBiM6htyx7YvXMLtuXfzYyb3d4y/2kbhBk4y TXKo4ZY9OuxAsYvWMcyTgvmoYHXW3Prn1vhxRud/Gu7t2ANCj2GbhRgQQy7cadcOt4kao edTBLwuJY3qHfofTutCqixMh3hAFmULDvOIWMhImYIFWqsjjmWk2udrhLWxGSvkr8XVga Dqro8ilW/oFOheTdvUvzcc63N+h19IjVXALpzDjxZKAVxWhiyT4khdx4l57kEH2FKCkkS DsRXHVQrAfu/REbkGZ+vqxIAYZHwmTc6N/3sUxH4w3BsaqMTwXU3kJ4RHJJVO+7SqHg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792522541; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=4PK2lzk2mI4nQc8YfV5A1vWK0eiPo0oKUX3U4tb8dEk=; b=bH2hCEX+HwDC1NQGX1Sw2YjmZGwaZzCbJaCvj7fXKFurqxINeTxLQdA3N+GTXUawwyZ9 NrUb/StD3zt5LEj/D1O/w2VnnznLBNfcMl4gvPlAOLy+Fw3cqHswFK7OsvLsPaa7QZvI9 ap29idzrqrCzlx7/gsKxh8iUAikUhCeglalNbvEl6stZNKcbyNTReETj3AX3h4tDWEgpO sww9t9kpx/p2eWduXQ4/tfTE0eCNlIsE7CF4jM2yDQ3ZQlwUVSWbPcGaqyYEPKhlpT1le nT31X2+iHYBZQgMzOQj3hZ55mnZAOldQhEN6tITDmj+wpjfQCGhFfGY6Rr/j0KcaNig== 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=ixrA1YXo; 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 48872606A319; Tue, 20 Oct 2026 18:55:41 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B95591F000C9; Tue, 20 Oct 2026 18:55:38 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792522540; bh=4PK2lzk2mI4nQc8YfV5A1vWK0eiPo0oKUX3U4tb8dEk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ixrA1YXoG1+qDDsa71ntE6lr2e2co5LFsNrTKt8FNl3m6zEf+qKK604id9y1tabd8 14W+Z3DkFxcjCaLductg5BAFEYKUO/ziRrIBgad7TlD7Ux5YukQqYgpeulnSiaMR62 N0aRHjT3HzxcpmuNxWh2VOoAmQgl4EOdXN8PUXHgSsGXT7AT/fKY45YiDCm8mZNXWR 5E1OveQbNkOjLlxffgevQBqSit/uR6E5Gn2TBr9dhF7BshNAWk2hR7vV1c0HogUU4Q QsDZ+HUowwJwoEVGcYgikapOSOf2EUNvV5YE2kuXOITX6tvb6g3I6tsnyU6ACMGpUL ZMXY+v7EkiUFg== X-Cc: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>, 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>, Michal Simek <michal.simek@amd.com>, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@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: <20261013-b4-axienet-dmaengine-ring-head-v1-1-7add24e74477@toxicpanda.com>