Re: [PATCH net v3] net: pch_gbe: handle TX skb allocation failure

From: Simon Horman

Date: Wed Jun 17 2026 - 04:26:16 EST


On Mon, Jun 15, 2026 at 08:50:42PM +0800, Ruoyu Wang wrote:
> pch_gbe_alloc_tx_buffers() allocates an skb for each TX descriptor and
> then passes the returned pointer to skb_reserve(). If netdev_alloc_skb()
> fails, skb_reserve() dereferences NULL.
>
> Make pch_gbe_alloc_tx_buffers() return an error when an skb allocation
> fails. On failure, let pch_gbe_alloc_tx_buffers() clean the partially
> allocated TX ring before returning the error. While bringing the device
> up, release the RX buffer pool through a shared cleanup helper before
> unwinding the IRQ setup.
>
> Fixes: 77555ee72282 ("net: Add Gigabit Ethernet driver of Topcliff PCH")
> Signed-off-by: Ruoyu Wang <ruoyuw560@xxxxxxxxx>
> ---
> Changes in v3:
> - Move the partial TX ring cleanup into pch_gbe_alloc_tx_buffers(), as
> suggested by Simon Horman.
>
> Changes in v2:
> - Add the kernel-doc return value description for
> pch_gbe_alloc_tx_buffers().

Thanks for the updates.

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>