]> git.ipfire.org Git - thirdparty/linux.git/commit
net: pch_gbe: handle TX skb allocation failure
authorRuoyu Wang <ruoyuw560@gmail.com>
Mon, 15 Jun 2026 12:50:42 +0000 (20:50 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 19 Jun 2026 01:00:35 +0000 (18:00 -0700)
commita0aa6bf985aa5f22f7d398ddfff3aa0754892aea
treebacb1449a2ba0a4026c5bde14a305b7d935bb1b4
parentd31deeab707b7945a7805d6406d0cd3118e640ef
net: pch_gbe: handle TX skb allocation failure

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.

Cc: stable+noautosel@kernel.org # untested fix to unlikely error path
Fixes: 77555ee72282 ("net: Add Gigabit Ethernet driver of Topcliff PCH")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260615125043.3537046-1-ruoyuw560@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c