patch 'eal/linux: fix illegal memory access in uevent handler' has been queued to stable release 21.11.1

Kevin Traynor ktraynor at redhat.com
Tue Mar 1 11:42:57 CET 2022


Hi,

FYI, your patch has been queued to stable release 21.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/06/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/411a43ea5d58e27534b5a7615448b70eaddd93a7

Thanks.

Kevin

---
>From 411a43ea5d58e27534b5a7615448b70eaddd93a7 Mon Sep 17 00:00:00 2001
From: Steve Yang <stevex.yang at intel.com>
Date: Wed, 23 Feb 2022 08:49:50 +0000
Subject: [PATCH] eal/linux: fix illegal memory access in uevent handler

[ upstream commit 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 ]

'recv()' fills the 'buf', later 'strlcpy()' used to copy from this buffer.
But as coverity warns 'recv()' doesn't guarantee that 'buf' is
null-terminated, but 'strlcpy()' requires it.

Enlarge 'buf' size to 'EAL_UEV_MSG_LEN + 1' and ensure the last one can
be set to 0 when received buffer size is EAL_UEV_MSG_LEN.

CID 375864:  Memory - illegal accesses  (STRING_NULL)
Passing unterminated string "buf" to "dev_uev_parse", which expects
a null-terminated string.

Coverity issue: 375864
Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")

Signed-off-by: Steve Yang <stevex.yang at intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 lib/eal/linux/eal_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index bde55a3d92..851789e85c 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -232,5 +232,5 @@ dev_uev_handler(__rte_unused void *param)
 	struct rte_dev_event uevent;
 	int ret;
-	char buf[EAL_UEV_MSG_LEN];
+	char buf[EAL_UEV_MSG_LEN + 1];
 	struct rte_bus *bus;
 	struct rte_device *dev;
@@ -238,5 +238,5 @@ dev_uev_handler(__rte_unused void *param)
 
 	memset(&uevent, 0, sizeof(struct rte_dev_event));
-	memset(buf, 0, EAL_UEV_MSG_LEN);
+	memset(buf, 0, EAL_UEV_MSG_LEN + 1);
 
 	if (rte_intr_fd_get(intr_handle) < 0)
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-03-01 10:41:04.118987672 +0000
+++ 0101-eal-linux-fix-illegal-memory-access-in-uevent-handle.patch	2022-03-01 10:41:01.484244135 +0000
@@ -1 +1 @@
-From 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 Mon Sep 17 00:00:00 2001
+From 411a43ea5d58e27534b5a7615448b70eaddd93a7 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 1a287fc9c95bd6245c119b20f07382cf4b8fefa4 ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
@@ -28 +29 @@
-index f6e5861221..e6f509bcff 100644
+index bde55a3d92..851789e85c 100644
@@ -31 +32 @@
-@@ -228,5 +228,5 @@ dev_uev_handler(__rte_unused void *param)
+@@ -232,5 +232,5 @@ dev_uev_handler(__rte_unused void *param)
@@ -38 +39 @@
-@@ -234,5 +234,5 @@ dev_uev_handler(__rte_unused void *param)
+@@ -238,5 +238,5 @@ dev_uev_handler(__rte_unused void *param)



More information about the stable mailing list