]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
octeon_ep_vf: add NULL check for napi_build_skb()
authorDavid Carlier <devnexen@gmail.com>
Tue, 5 May 2026 07:38:09 +0000 (03:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 May 2026 13:31:19 +0000 (15:31 +0200)
commit6fef6640bbf360e254cc0174365ed30ce3a07572
treea414f67c493238a3bea1ab53394c891af193ade8
parent201128fcc7b213d27ab77bc4e89488b41796480f
octeon_ep_vf: add NULL check for napi_build_skb()

[ Upstream commit dd66b42854705e4e4ee7f14d260f86c578bed3e3 ]

napi_build_skb() can return NULL on allocation failure. In
__octep_vf_oq_process_rx(), the result is used directly without a NULL
check in both the single-buffer and multi-fragment paths, leading to a
NULL pointer dereference.

Add NULL checks after both napi_build_skb() calls, properly advancing
descriptors and consuming remaining fragments on failure.

Fixes: 1cd3b407977c ("octeon_ep_vf: add Tx/Rx processing and interrupt support")
Cc: stable@vger.kernel.org
Signed-off-by: David Carlier <devnexen@gmail.com>
Link: https://patch.msgid.link/20260409184009.930359-3-devnexen@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ inlined missing octep_vf_oq_next_idx() helper as read_idx++ with wraparound ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c