[dpdk-stable] patch 'net/ice/base: check memory pointer before copying' has been queued to stable release 19.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Tue May 19 15:02:50 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/21/20. 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.

Thanks.

Luca Boccassi

---
>From f50974db04c6890ea52c51395af5252f690bce71 Mon Sep 17 00:00:00 2001
From: Haiyue Wang <haiyue.wang at intel.com>
Date: Tue, 31 Mar 2020 14:50:34 +0800
Subject: [PATCH] net/ice/base: check memory pointer before copying

[ upstream commit 2adbccec40663c457a47391b8d704bceb579c2f0 ]

The ice_memdup doesn't check the new allocated memory pointer, it calls
the rte_memcpy directly. It should check it.

Fixes: 5f0978e96220 ("net/ice/base: add OS specific implementation")

Signed-off-by: Haiyue Wang <haiyue.wang at intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye at intel.com>
---
 drivers/net/ice/base/ice_osdep.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 629acef227..7310cd0a27 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -24,6 +24,8 @@
 #include <rte_random.h>
 #include <rte_io.h>
 
+#include "ice_alloc.h"
+
 #include "../ice_logs.h"
 
 #define INLINE inline
@@ -176,7 +178,6 @@ struct ice_virt_mem {
 
 #define ice_memset(a, b, c, d) memset((a), (b), (c))
 #define ice_memcpy(a, b, c, d) rte_memcpy((a), (b), (c))
-#define ice_memdup(a, b, c, d) rte_memcpy(ice_malloc(a, c), b, c)
 
 #define CPU_TO_BE16(o) rte_cpu_to_be_16(o)
 #define CPU_TO_BE32(o) rte_cpu_to_be_32(o)
@@ -223,6 +224,19 @@ ice_destroy_lock(__attribute__((unused)) struct ice_lock *sp)
 
 struct ice_hw;
 
+static __rte_always_inline void *
+ice_memdup(__rte_unused struct ice_hw *hw, const void *src, size_t size,
+	   __rte_unused enum ice_memcpy_type dir)
+{
+	void *p;
+
+	p = ice_malloc(hw, size);
+	if (p)
+		rte_memcpy(p, src, size);
+
+	return p;
+}
+
 static inline void *
 ice_alloc_dma_mem(__attribute__((unused)) struct ice_hw *hw,
 		  struct ice_dma_mem *mem, u64 size)
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-19 14:04:46.013261651 +0100
+++ 0035-net-ice-base-check-memory-pointer-before-copying.patch	2020-05-19 14:04:44.172647575 +0100
@@ -1,13 +1,14 @@
-From 2adbccec40663c457a47391b8d704bceb579c2f0 Mon Sep 17 00:00:00 2001
+From f50974db04c6890ea52c51395af5252f690bce71 Mon Sep 17 00:00:00 2001
 From: Haiyue Wang <haiyue.wang at intel.com>
 Date: Tue, 31 Mar 2020 14:50:34 +0800
 Subject: [PATCH] net/ice/base: check memory pointer before copying
 
+[ upstream commit 2adbccec40663c457a47391b8d704bceb579c2f0 ]
+
 The ice_memdup doesn't check the new allocated memory pointer, it calls
 the rte_memcpy directly. It should check it.
 
 Fixes: 5f0978e96220 ("net/ice/base: add OS specific implementation")
-Cc: stable at dpdk.org
 
 Signed-off-by: Haiyue Wang <haiyue.wang at intel.com>
 Reviewed-by: Xiaolong Ye <xiaolong.ye at intel.com>
@@ -16,7 +17,7 @@
  1 file changed, 15 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
-index 0955f565af..c70f5f8a7e 100644
+index 629acef227..7310cd0a27 100644
 --- a/drivers/net/ice/base/ice_osdep.h
 +++ b/drivers/net/ice/base/ice_osdep.h
 @@ -24,6 +24,8 @@
@@ -27,16 +28,16 @@
 +
  #include "../ice_logs.h"
  
- #ifndef __INTEL_NET_BASE_OSDEP__
-@@ -193,7 +195,6 @@ struct ice_virt_mem {
+ #define INLINE inline
+@@ -176,7 +178,6 @@ struct ice_virt_mem {
  
  #define ice_memset(a, b, c, d) memset((a), (b), (c))
  #define ice_memcpy(a, b, c, d) rte_memcpy((a), (b), (c))
 -#define ice_memdup(a, b, c, d) rte_memcpy(ice_malloc(a, c), b, c)
  
- /* SW spinlock */
- struct ice_lock {
-@@ -225,6 +226,19 @@ ice_destroy_lock(__rte_unused struct ice_lock *sp)
+ #define CPU_TO_BE16(o) rte_cpu_to_be_16(o)
+ #define CPU_TO_BE32(o) rte_cpu_to_be_32(o)
+@@ -223,6 +224,19 @@ ice_destroy_lock(__attribute__((unused)) struct ice_lock *sp)
  
  struct ice_hw;
  
@@ -54,7 +55,7 @@
 +}
 +
  static inline void *
- ice_alloc_dma_mem(__rte_unused struct ice_hw *hw,
+ ice_alloc_dma_mem(__attribute__((unused)) struct ice_hw *hw,
  		  struct ice_dma_mem *mem, u64 size)
 -- 
 2.20.1


More information about the stable mailing list