DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] net/ena/base bug fix for 23.11 stable only
@ 2024-03-28 13:49 shaibran
  2024-03-28 13:49 ` [PATCH 1/1] net/ena: fix metrics excessive memory consumption shaibran
  0 siblings, 1 reply; 2+ messages in thread
From: shaibran @ 2024-03-28 13:49 UTC (permalink / raw)
  To: ferruh.yigit, bluca, christian.ehrhardt, xuemingl, ktraynor
  Cc: stable, dev, Shai Brandes

From: Shai Brandes <shaibran@amazon.com>

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: fix metrics excessive memory consumption

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

-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] net/ena: fix metrics excessive memory consumption
  2024-03-28 13:49 [PATCH 0/1] net/ena/base bug fix for 23.11 stable only shaibran
@ 2024-03-28 13:49 ` shaibran
  0 siblings, 0 replies; 2+ messages in thread
From: shaibran @ 2024-03-28 13:49 UTC (permalink / raw)
  To: ferruh.yigit, bluca, christian.ehrhardt, xuemingl, ktraynor
  Cc: stable, dev, Shai Brandes

From: Shai Brandes <shaibran@amazon.com>

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.

Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
Fixes: f73f53f7dc7a ("net/ena: upgrade HAL")
Bugzilla ID: 14001
---
 drivers/net/ena/base/ena_com.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c
index 6953a1fa33..8ae7dcf48e 100644
--- a/drivers/net/ena/base/ena_com.c
+++ b/drivers/net/ena/base/ena_com.c
@@ -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;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-28 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 13:49 [PATCH 0/1] net/ena/base bug fix for 23.11 stable only shaibran
2024-03-28 13:49 ` [PATCH 1/1] net/ena: fix metrics excessive memory consumption shaibran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).