* [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only
@ 2024-04-08 12:15 shaibran
2024-04-08 12:15 ` [PATCH v2 1/1] net/ena/base: fix metrics excessive memory consumption shaibran
0 siblings, 1 reply; 6+ messages in thread
From: shaibran @ 2024-04-08 12:15 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.
All the best,
Shai
---
v2:
* reordered the tags in the commit message
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/1] net/ena/base: fix metrics excessive memory consumption
2024-04-08 12:15 [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only shaibran
@ 2024-04-08 12:15 ` shaibran
2024-04-13 8:23 ` Xueming Li
0 siblings, 1 reply; 6+ messages in thread
From: shaibran @ 2024-04-08 12:15 UTC (permalink / raw)
To: ferruh.yigit, bluca, christian.ehrhardt, xuemingl, ktraynor
Cc: stable, dev, Shai Brandes
From: Shai Brandes <shaibran@amazon.com>
[ upstream commit c8a1898f82f8c04cbe1d3e2d0eec0705386c23f7 ]
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.
Bugzilla ID: 1400
Fixes: f73f53f7dc7a ("net/ena: upgrade HAL")
Cc: stable@dpdk.org
Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
---
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] 6+ messages in thread
* Re: [PATCH v2 1/1] net/ena/base: fix metrics excessive memory consumption
2024-04-08 12:15 ` [PATCH v2 1/1] net/ena/base: fix metrics excessive memory consumption shaibran
@ 2024-04-13 8:23 ` Xueming Li
0 siblings, 0 replies; 6+ messages in thread
From: Xueming Li @ 2024-04-13 8:23 UTC (permalink / raw)
To: shaibran, ferruh.yigit, bluca, christian.ehrhardt, ktraynor; +Cc: stable, dev
[-- Attachment #1: Type: text/plain, Size: 2548 bytes --]
Hi Shai,
Thanks for the backporting, patch queued to 23.11.1 staging branch.
________________________________
From: shaibran@amazon.com <shaibran@amazon.com>
Sent: Monday, April 8, 2024 8:15 PM
To: ferruh.yigit@amd.com <ferruh.yigit@amd.com>; bluca@debian.org <bluca@debian.org>; christian.ehrhardt@canonical.com <christian.ehrhardt@canonical.com>; Xueming Li <xuemingl@nvidia.com>; ktraynor@redhat.com <ktraynor@redhat.com>
Cc: stable@dpdk.org <stable@dpdk.org>; dev@dpdk.org <dev@dpdk.org>; Shai Brandes <shaibran@amazon.com>
Subject: [PATCH v2 1/1] net/ena/base: fix metrics excessive memory consumption
From: Shai Brandes <shaibran@amazon.com>
[ upstream commit c8a1898f82f8c04cbe1d3e2d0eec0705386c23f7 ]
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.
Bugzilla ID: 1400
Fixes: f73f53f7dc7a ("net/ena: upgrade HAL")
Cc: stable@dpdk.org
Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
---
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
[-- Attachment #2: Type: text/html, Size: 5284 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only
@ 2024-03-28 14:03 shaibran
2024-03-28 14:22 ` Brandes, Shai
0 siblings, 1 reply; 6+ messages in thread
From: shaibran @ 2024-03-28 14:03 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/base: 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] 6+ messages in thread
* RE: [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only
2024-03-28 14:03 [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only shaibran
@ 2024-03-28 14:22 ` Brandes, Shai
2024-03-28 14:29 ` Luca Boccassi
0 siblings, 1 reply; 6+ messages in thread
From: Brandes, Shai @ 2024-03-28 14:22 UTC (permalink / raw)
To: Brandes, Shai, ferruh.yigit, bluca, christian.ehrhardt, xuemingl,
ktraynor
Cc: stable, dev
Sorry, for some reason this appears on the wrong branch
I will fix this and upload a new patch
> -----Original Message-----
> From: shaibran@amazon.com <shaibran@amazon.com>
> Sent: Thursday, March 28, 2024 4:03 PM
> To: ferruh.yigit@amd.com; bluca@debian.org;
> christian.ehrhardt@canonical.com; xuemingl@nvidia.com;
> ktraynor@redhat.com
> Cc: stable@dpdk.org; dev@dpdk.org; Brandes, Shai
> <shaibran@amazon.com>
> Subject: [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only
>
> 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/base: 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] 6+ messages in thread
* Re: [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only
2024-03-28 14:22 ` Brandes, Shai
@ 2024-03-28 14:29 ` Luca Boccassi
0 siblings, 0 replies; 6+ messages in thread
From: Luca Boccassi @ 2024-03-28 14:29 UTC (permalink / raw)
To: Brandes, Shai
Cc: ferruh.yigit, christian.ehrhardt, xuemingl, ktraynor, stable, dev
Please see https://core.dpdk.org/contribute/ for instructions on
sending patches for stable releases, otherwise they will be missed
On Thu, 28 Mar 2024 at 14:22, Brandes, Shai <shaibran@amazon.com> wrote:
>
> Sorry, for some reason this appears on the wrong branch
> I will fix this and upload a new patch
>
> > -----Original Message-----
> > From: shaibran@amazon.com <shaibran@amazon.com>
> > Sent: Thursday, March 28, 2024 4:03 PM
> > To: ferruh.yigit@amd.com; bluca@debian.org;
> > christian.ehrhardt@canonical.com; xuemingl@nvidia.com;
> > ktraynor@redhat.com
> > Cc: stable@dpdk.org; dev@dpdk.org; Brandes, Shai
> > <shaibran@amazon.com>
> > Subject: [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only
> >
> > 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/base: 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] 6+ messages in thread
end of thread, other threads:[~2024-04-13 8:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 12:15 [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only shaibran
2024-04-08 12:15 ` [PATCH v2 1/1] net/ena/base: fix metrics excessive memory consumption shaibran
2024-04-13 8:23 ` Xueming Li
-- strict thread matches above, loose matches on Subject: below --
2024-03-28 14:03 [PATCH v2 0/1] net/ena/base: bug fix for 23.11 stable only shaibran
2024-03-28 14:22 ` Brandes, Shai
2024-03-28 14:29 ` Luca Boccassi
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).