Skip to contentSkip to conversation

net/ena/base: bug fix for 23.11 stable only

PATCH Superseded [email protected] 2 participants 4 messages Mar 28, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

v2 cover net/ena/base: bug fix for 23.11 stable only

From: Shai Brandes <[email protected]>

Hi, the fix is for a bug that was introduced in 23.11.
The fix was already merged into 24.03 indirectly as part of c8a1898f82f8 ("net/ena: improve style and readability") and the entire function was later restructured in patch bcb1753156ac ("net/ena/base: modify customer metrics memory management") Meaning, this issue is indirectly fixed going forward, but we need to introduce a dedicated fix for 23.11 stable only. I CC'ed also dev mailing list since this involves Bugzilla bug fix.
Sorry in advance in case this is not the correct procedure.

All the best,
Shai

Shai Brandes (1):
net/ena/base: fix metrics excessive memory consumption

 drivers/net/ena/base/ena_com.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 net/ena/base: fix metrics excessive memory consumption

From: Shai Brandes <[email protected]>

The driver accidentally allocates a huge memory buffer for the customer metrics because it uses an uninitialized variable for the buffer length. This can lead to excessive memory footprint for the driver which can even fail to initialize in case of insufficient memory.

Fixes f73f53f7dc7a ("net/ena: upgrade HAL")

Bugzilla ID: 1400

---
 drivers/net/ena/base/ena_com.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ena/base/ena_com.c +5 -3
index 6953a1fa33..8ae7dcf48e 100644
@@ -3134,16 +3134,18 @@ int ena_com_allocate_debug_area(struct ena_com_dev *ena_dev,
 int ena_com_allocate_customer_metrics_buffer(struct ena_com_dev *ena_dev)
 {
 	struct ena_customer_metrics *customer_metrics = &ena_dev->customer_metrics;
+	customer_metrics->buffer_len = ENA_CUSTOMER_METRICS_BUFFER_SIZE;
+	customer_metrics->buffer_virt_addr = NULL;
 
 	ENA_MEM_ALLOC_COHERENT(ena_dev->dmadev,
 			       customer_metrics->buffer_len,
 			       customer_metrics->buffer_virt_addr,
 			       customer_metrics->buffer_dma_addr,
 			       customer_metrics->buffer_dma_handle);
-	if (unlikely(customer_metrics->buffer_virt_addr == NULL))
+	if (unlikely(customer_metrics->buffer_virt_addr == NULL)) {
+		customer_metrics->buffer_len = 0;
 		return ENA_COM_NO_MEM;
-
-	customer_metrics->buffer_len = ENA_CUSTOMER_METRICS_BUFFER_SIZE;
+	}
 
 	return 0;
 }
Signature · 1 line
2.17.1
#2 lore raw
In reply to [email protected]

Sorry, for some reason this appears on the wrong branch I will fix this and upload a new patch

Quoted 32 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, March 28, 2024 4:03 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Brandes, Shai <[email protected]>
Subject: [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only

From: Shai Brandes <[email protected]>

Hi, the fix is for a bug that was introduced in 23.11.
The fix was already merged into 24.03 indirectly as part of c8a1898f82f8 ("net/ena: improve style and readability") and the entire function was later restructured in patch bcb1753156ac ("net/ena/base: modify customer metrics memory management") Meaning, this issue is indirectly fixed going forward, but we need to introduce a dedicated fix for 23.11 stable only. I CC'ed also dev mailing list since this involves Bugzilla bug fix. Sorry in advance in case this is not the correct procedure.

All the best,
Shai

Shai Brandes (1):
net/ena/base: fix metrics excessive memory consumption

 drivers/net/ena/base/ena_com.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--
2.17.1

#3 lore raw

Please see https://core.dpdk.org/contribute/ for instructions on sending patches for stable releases, otherwise they will be missed

Quoted 37 lines · Shai

Sorry, for some reason this appears on the wrong branch I will fix this and upload a new patch

Quoted 32 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, March 28, 2024 4:03 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Brandes, Shai <[email protected]>
Subject: [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only

From: Shai Brandes <[email protected]>

Hi, the fix is for a bug that was introduced in 23.11.
The fix was already merged into 24.03 indirectly as part of c8a1898f82f8 ("net/ena: improve style and readability") and the entire function was later restructured in patch bcb1753156ac ("net/ena/base: modify customer metrics memory management") Meaning, this issue is indirectly fixed going forward, but we need to introduce a dedicated fix for 23.11 stable only. I CC'ed also dev mailing list since this involves Bugzilla bug fix. Sorry in advance in case this is not the correct procedure.

All the best,
Shai

Shai Brandes (1):
net/ena/base: fix metrics excessive memory consumption

 drivers/net/ena/base/ena_com.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--
2.17.1