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 v3 2/2] net: sxgbe: check descriptor ring allocation failures
Date: Thu, 23 Jul 2026 11:11:40 +0100 [thread overview]
Message-ID: <805de3f6-8263-45d6-b6fe-e07d11d254b4@linux.dev> (raw)
In-Reply-To: <20260723021820.203960-3-chenguang.zhao@linux.dev>
On 23/07/2026 03:18, Chenguang Zhao wrote:
> From: Chenguang Zhao <zhaochenguang@kylinos.cn>
>
> sxgbe_open() ignores the return value of init_dma_desc_rings() and
> continues to program DMA with invalid ring addresses when allocation
> fails. Check the return value and disconnect the PHY on failure.
>
> 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 | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> index 9b48a587d5c2..70cf3619555f 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> @@ -1078,7 +1078,9 @@ static int sxgbe_open(struct net_device *dev)
> priv->dma_buf_sz = SXGBE_ALIGN(DMA_BUFFER_SIZE);
> priv->tx_tc = TC_DEFAULT;
> priv->rx_tc = TC_DEFAULT;
> - init_dma_desc_rings(dev);
> + ret = init_dma_desc_rings(dev);
> + if (ret)
> + goto init_phy_error;
>
> /* DMA initialization and SW reset */
> ret = sxgbe_init_dma_engine(priv);
> @@ -1187,6 +1189,7 @@ static int sxgbe_open(struct net_device *dev)
>
> init_error:
> free_dma_desc_resources(priv);
> +init_phy_error:
nit: better to name it init_dma_error
> if (dev->phydev)
> phy_disconnect(dev->phydev);
> phy_error:
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
next prev parent reply other threads:[~2026-07-23 10:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 2:18 [PATCH net v3 0/2] net: sxgbe: fix descriptor ring allocation failure handling Chenguang Zhao
2026-07-23 2:18 ` [PATCH net v3 1/2] net: sxgbe: free TX rings on RX allocation failure Chenguang Zhao
2026-07-23 10:07 ` Vadim Fedorenko
2026-07-23 2:18 ` [PATCH net v3 2/2] net: sxgbe: check descriptor ring allocation failures Chenguang Zhao
2026-07-23 10:11 ` Vadim Fedorenko [this message]
2026-07-23 13:42 ` [PATCH net v3 0/2] net: sxgbe: fix descriptor ring allocation failure handling Jakub Kicinski
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=805de3f6-8263-45d6-b6fe-e07d11d254b4@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox