gve: add missing NULL check for gve_alloc_pending_packet() in TX DQO
[ Upstream commit 12c331b29c7397ac3b03584e12902990693bc248 ]
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: a57e5de476
("gve: DQO: Add TX path")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: Mina Almasry <almasrymina@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9c49728b61
commit
7f6265fce3
@@ -716,6 +716,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;
|
||||
|
||||
|
Reference in New Issue
Block a user