* [PATCH 18/21] net/ena/base: fix unsafe memcpy on invalid memory
@ 2025-10-15 7:16 Shai Brandes
0 siblings, 0 replies; only message in thread
From: Shai Brandes @ 2025-10-15 7:16 UTC (permalink / raw)
To: stephen; +Cc: dev, Shai Brandes, stable
The return status check was placed after a memcpy operation,
which could result in copying from an invalid memory region
if the feature fetch failed.
Fixes: b68309be44c0 ("net/ena/base: update communication layer for the ENAv2")
Cc: stable@dpdk.org
Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
Reviewed-by: Yosef Raisman <yraisman@amazon.com>
---
drivers/net/ena/base/ena_com.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c
index b4437f532b..b003167bed 100644
--- a/drivers/net/ena/base/ena_com.c
+++ b/drivers/net/ena/base/ena_com.c
@@ -2476,13 +2476,13 @@ int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev,
} else {
rc = ena_com_get_feature(ena_dev, &get_resp,
ENA_ADMIN_MAX_QUEUES_NUM, 0);
+ if (rc)
+ return rc;
+
memcpy(&get_feat_ctx->max_queues, &get_resp.u.max_queue,
sizeof(get_resp.u.max_queue));
ena_dev->tx_max_header_size =
get_resp.u.max_queue.max_header_size;
-
- if (rc)
- return rc;
}
rc = ena_com_get_feature(ena_dev, &get_resp,
--
2.17.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-15 7:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-15 7:16 [PATCH 18/21] net/ena/base: fix unsafe memcpy on invalid memory Shai Brandes
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).