Commit 12c331b2 authored by Alok Tiwari's avatar Alok Tiwari Committed by David S. Miller
Browse files

gve: add missing NULL check for gve_alloc_pending_packet() in TX DQO



gve_alloc_pending_packet() can return NULL, but gve_tx_add_skb_dqo()
did not check for this case before dereferencing the returned pointer.

Add a missing NULL check to prevent a potential NULL pointer
dereference when allocation fails.

This improves robustness in low-memory scenarios.

Fixes: a57e5de4 ("gve: DQO: Add TX path")
Signed-off-by: default avatarAlok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: default avatarMina Almasry <almasrymina@google.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b56bbaf8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -764,6 +764,9 @@ static int gve_tx_add_skb_dqo(struct gve_tx_ring *tx,
	s16 completion_tag;

	pkt = gve_alloc_pending_packet(tx);
	if (!pkt)
		return -ENOMEM;

	pkt->skb = skb;
	completion_tag = pkt - tx->dqo.pending_packets;