Skip to content

Commit 12c331b

Browse files
aloktiwadavem330
authored andcommitted
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: a57e5de ("gve: DQO: Add TX path") Signed-off-by: Alok Tiwari <[email protected]> Reviewed-by: Mina Almasry <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b56bbaf commit 12c331b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/ethernet/google/gve/gve_tx_dqo.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,9 @@ static int gve_tx_add_skb_dqo(struct gve_tx_ring *tx,
764764
s16 completion_tag;
765765

766766
pkt = gve_alloc_pending_packet(tx);
767+
if (!pkt)
768+
return -ENOMEM;
769+
767770
pkt->skb = skb;
768771
completion_tag = pkt - tx->dqo.pending_packets;
769772

0 commit comments

Comments
 (0)