All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: liquidio: Check soft command allocation in lio_main setup_nic_devices()
@ 2026-06-23 12:56 Haoxiang Li
  2026-06-23 13:31 ` Breno Leitao
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-06-23 12:56 UTC (permalink / raw)
  To: andrew+netdev, davem, kuba, pabeni, kory.maincent, zilin, petrm,
	u.kleine-koenig, marco.crivellari, vadim.fedorenko,
	Aleksey.Makarov, satananda.burla, felix.manlunas, derek.chickles,
	rvatsavayi
  Cc: netdev, linux-kernel, Haoxiang Li, stable

octeon_alloc_soft_command() returns NULL when the soft command buffer
pool is empty. setup_nic_devices() dereferences the returned pointer
immediately when preparing the interface configuration command, which
can lead to a NULL pointer dereference if the pool is exhausted.

Return -ENOMEM when the allocation fails and let the existing NIC init
failure path handle the error.

Fixes: f21fb3ed364b ("Add support of Cavium Liquidio ethernet adapters")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/net/ethernet/cavium/liquidio/lio_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 0db08ac3d098..5077129656e8 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -3363,6 +3363,9 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
 		sc = (struct octeon_soft_command *)
 			octeon_alloc_soft_command(octeon_dev, data_size,
 						  resp_size, 0);
+		if (!sc)
+			return -ENOMEM;
+
 		resp = (struct liquidio_if_cfg_resp *)sc->virtrptr;
 		vdata = (struct lio_version *)sc->virtdptr;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-23 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 12:56 [PATCH] net: liquidio: Check soft command allocation in lio_main setup_nic_devices() Haoxiang Li
2026-06-23 13:31 ` Breno Leitao

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.