From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Chenguang Zhao <chenguang.zhao@linux.dev>,
bh74.an@samsung.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, Chenguang Zhao <zhaochenguang@kylinos.cn>
Subject: Re: [PATCH net v2 1/2] net: sxgbe: free TX rings on RX allocation failure
Date: Wed, 22 Jul 2026 11:50:36 +0100 [thread overview]
Message-ID: <32855493-a1d8-4632-aa54-ba667ff56ab5@linux.dev> (raw)
In-Reply-To: <20260722014055.157269-2-chenguang.zhao@linux.dev>
On 22/07/2026 02:40, Chenguang Zhao wrote:
> From: Chenguang Zhao <zhaochenguang@kylinos.cn>
>
> When RX descriptor ring allocation fails, init_dma_desc_rings() only
> frees the partially allocated RX rings and returns. The TX rings that
> were allocated earlier in the same function are leaked.
>
> Mirror the TX allocation error path and release all TX rings before
> returning the error.
>
> Fixes: 1edb9ca69e8a ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver")
> Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
> ---
> drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> index 5051ada43d2f..fc7b72627f2a 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> @@ -605,6 +605,9 @@ static int init_dma_desc_rings(struct net_device *netd)
> rxalloc_err:
> while (queue_num--)
> free_rx_ring(priv->device, priv->rxq[queue_num], rx_rsize);
> + queue_num = SXGBE_TX_QUEUES;
> + while (queue_num--)
> + free_tx_ring(priv->device, priv->txq[queue_num], tx_rsize);
> return ret;
> }
>
There is already some error code to clear tx rings. It makes more sense
to rearrange labels to reuse already existing code.
next prev parent reply other threads:[~2026-07-22 10:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 1:40 [PATCH net v2 0/2] net: sxgbe: fix descriptor ring allocation failure handling Chenguang Zhao
2026-07-22 1:40 ` [PATCH net v2 1/2] net: sxgbe: free TX rings on RX allocation failure Chenguang Zhao
2026-07-22 10:50 ` Vadim Fedorenko [this message]
2026-07-22 1:40 ` [PATCH net v2 2/2] net: sxgbe: check descriptor ring allocation failures Chenguang Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=32855493-a1d8-4632-aa54-ba667ff56ab5@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=bh74.an@samsung.com \
--cc=chenguang.zhao@linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zhaochenguang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.