From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1CBA0A0093 for ; Tue, 19 May 2020 15:07:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 11A931D676; Tue, 19 May 2020 15:07:39 +0200 (CEST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by dpdk.org (Postfix) with ESMTP id 740411D672 for ; Tue, 19 May 2020 15:07:38 +0200 (CEST) Received: by mail-wm1-f44.google.com with SMTP id u1so2212129wmn.3 for ; Tue, 19 May 2020 06:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KwRxlh91H8UuUv47kbxPEALc6iUrlIfdAJXVeZ4jDlk=; b=NMqcAnNaifj1GHVHjYCjJ0FsXuiwEQWUmfYtcsrNVSvUNKGlInJD2hh4x0GBl1v6W8 k33UJCPxUpEdXTy451YscvTTSUR3/1zM+yOVoSdcB89az4H9C3e9KWdFVz2MLm3jsO2a pUBTSHeldgB5iyHhdge4600ezFnQRWJwR2U3VM0OlZejL7qHjVaQUNQg8jVDqbfNGFCH 3cr/6XarhjCqgD4MID5xuI23zwtZE+3gabEOotsnfQGWkSdFQTxF7PeFuzSkMcxnoFV0 U+Dp9OrM/WkqAw2FrzCcoIRPXTUPonbFRw1OofxUO8px1kRTZ4+VTU5nTOUpIWGeIiOe dZOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KwRxlh91H8UuUv47kbxPEALc6iUrlIfdAJXVeZ4jDlk=; b=uTKNxeTFFu0LIkA8m0WO1PKag7TIV1Ae7mgAHILhfheBwkrym6tVuVJVsl93vM8cD4 r0ufnoJuCbAQRc/LkSJkDmKHuphHEVkVW/bfVD0fF6uxwdJFix48To4mwlgy8Hz1dzmV rG9O1TdrnRu4ouoCbR8u00Y4H5McWk6xrialRhO47jI/YFJzYFhXsPxWFHBoXWopOUg3 EknHVK4A08veNTo1pvq1Y8GVL+M3gKGHt3yeLWD8mD88KUCmJVuiQFmwiPnNrQjrR1Bm vx/Mexucx4Y9fgYKHHTgNzoyKd3HmUWBE9cRzqZwH/iIN7fgwKEYvs9F+wgDjZOaD9e3 DNgQ== X-Gm-Message-State: AOAM53164JXXVkQuD8MKaQtxD+DTCh+RJEp+fIH+0Mc2URBF64M9XVWO i+GzZZUWrEk0PcwV6LTYlnA= X-Google-Smtp-Source: ABdhPJxW5X/nEU29rzYcy33HmXMQVSLMCZd3y0envFTyi9hixG4oYWESlyWVIEFqzbGxz6rwTaZ7hA== X-Received: by 2002:a1c:81d0:: with SMTP id c199mr5185631wmd.125.1589893658213; Tue, 19 May 2020 06:07:38 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id r2sm21211489wrg.84.2020.05.19.06.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:07:37 -0700 (PDT) From: luca.boccassi@gmail.com To: Haiyue Wang Cc: Xiaolong Ye , dpdk stable Date: Tue, 19 May 2020 14:02:50 +0100 Message-Id: <20200519130549.112823-35-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519130549.112823-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> <20200519130549.112823-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/ice/base: check memory pointer before copying' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 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 Reviewed-by: Xiaolong Ye --- 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 #include +#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 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@dpdk.org Signed-off-by: Haiyue Wang Reviewed-by: Xiaolong Ye @@ -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