net: ena: set admin device pointer before queue allocations
Subsystems (3)
PATCH v2 1/1 net: ena: set admin device pointer before queue allocations
From: Wajeeh Atrash <[email protected]>
On the first probe, ena_com_admin_init() allocates the completion contexts and admin SQ/CQ buffers before setting admin_queue->ena_dev. Their allocation failure paths log through this pointer, which is still NULL. A failed allocation therefore dereferences NULL instead of returning -ENOMEM.
Set admin_queue->ena_dev before the first allocation so the helpers can log errors and return -ENOMEM normally.
This issue has already been fixed in Amazon's standalone ENA driver (commit 7d1dc4341d4f).
---
v2:
- target net instead of net-next
- credit Wajeeh Atrash as the author and add his Signed-off-by
- place the ena_dev assignment directly above q_dmadev
drivers/net/ethernet/amazon/ena/ena_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_com.c +1 -1
@@ -1992,6 +1992,7 @@ int ena_com_admin_init(struct ena_com_dev *ena_dev, admin_queue->q_depth =ENA_ADMIN_QUEUE_DEPTH ; + admin_queue->ena_dev = ena_dev; admin_queue->q_dmadev = ena_dev->dmadev; admin_queue->polling = false; admin_queue->curr_cmd_id =0 ;
@@ -2045,7 +2046,6 @@ int ena_com_admin_init(struct ena_com_dev *ena_dev,if (ret) goto error; - admin_queue->ena_dev = ena_dev; admin_queue->running_state = true;return 0 ;
base-commit: 070411c1590c8172eb4d86f045d99c372f22fe23
Signature · 1 line
2.43.0
Quoted 69 lines
-----Original Message-----
From: Avi Weiss <[email protected]>
Sent: Friday, November 13, 2026 10:56 PM
To: [email protected]
Cc: Kiyanovski, Arthur <[email protected]>; Arinzon, David <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Atrash, Wajeeh <[email protected]>; Avi Weiss <[email protected]>
Subject: [EXTERNAL] [PATCH net v2] net: ena: set admin device pointer before queue allocationsCAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.
From: Wajeeh Atrash <[email protected]>
On the first probe,
ena_com_admin_init()allocates the completion contexts and admin SQ/CQ buffers before settingadmin_queue->ena_dev. Their allocation failure paths log through this pointer, which is still NULL. A failed allocation therefore dereferences NULL instead of returning-ENOMEM.Set
admin_queue->ena_devbefore the first allocation so the helpers can log errors and return-ENOMEMnormally.This issue has already been fixed in Amazon's standalone ENA driver (commit
7d1dc4341d4f).Fixes da580ca8de2c ("net: ena: add device distinct log prefix to files")Signed-off-by Wajeeh Atrash <[email protected]>Signed-off-by Avi Weiss <[email protected]>---
v2:
- target net instead of net-next
- credit Wajeeh Atrash as the author and add his Signed-off-by
- place theena_devassignment directly aboveq_dmadevdrivers/net/ethernet/amazon/ena/ena_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/amazon/ena/ena_com.c +1
-0@@ -1992,6 +1992,7 @@ int ena_com_admin_init(struct ena_com_dev *ena_dev, admin_queue->q_depth =ENA_ADMIN_QUEUE_DEPTH ; + admin_queue->ena_dev = ena_dev; admin_queue->q_dmadev = ena_dev->dmadev; admin_queue->polling = false;admin_queue->curr_cmd_id = 0;drivers/net/ethernet/amazon/ena/ena_com.c +0
-1@@ -2045,7 +2046,6 @@ int ena_com_admin_init(struct ena_com_dev *ena_dev, if (ret) goto error; - admin_queue->ena_dev = ena_dev; admin_queue->running_state = true;return 0;
Quoted 3 lines
base-commit:
070411c1590c8172eb4d86f045d99c372f22fe23--
2.43.0