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 183FBA051C for ; Tue, 11 Feb 2020 12:39:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1089B5B3C; Tue, 11 Feb 2020 12:39:22 +0100 (CET) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 3A6521BFA1 for ; Tue, 11 Feb 2020 12:39:20 +0100 (CET) Received: by mail-wr1-f65.google.com with SMTP id z7so11887275wrl.13 for ; Tue, 11 Feb 2020 03:39:20 -0800 (PST) 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=EH9HeOB+qAPks8EzOi1vK+mTl8pzefQWPx4z+86g6Os=; b=L/UdM58x0QxUM+C37at11BYezmUE8cMcM6dVsTTLq5bHNbJRgTzsFaleBRF2oaUARs 7mwraCqC8aQ5RZCl5JzlKX1NJ6plJcpcRWgqveGu6NsLeSkJ6ywP0k4U9XVbJQNWn4GV y5Ia9GUWCyYbR6QwJXBRddItLJj13Q9rqoUpWEXf3Pd0KjWZrree45MfcRYT8+nLsPf0 xfmK+4sTu9joXZFw+G4qL07Itslsu194wLIq1rT10ZOIYNRUEMCX/0Yep7SKAiVWGSRA SkZmHx4wiw7O9qibg+zHoYibQMuhkDpgwdoOVypqzOCd1PM0041jHqv6nRM9wNKBkJU8 jOBg== 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=EH9HeOB+qAPks8EzOi1vK+mTl8pzefQWPx4z+86g6Os=; b=X/tKuXXmF+EPb2Asb0+c9TMMmCu0FzAwDbyjUmbXJWmuZ/5nYI42A1adZ44DuU/Usn DrTM/YdjlYoWcin9JDlhD6SFW3i0HHAR+INKMktIfM+MPhF5yXpLYqkNKtiyB708tBRJ sqEZQN0UwS2DSRq2GYpJRobECNXjwXIYdb8Gq1LNrvX7sQnf3FLV5Rd2UfGjgaCgeDb1 9USxur7lJ3e0ze2N6tk/BYw8cgMa6iwhiT0iUr0Dq0iIMY6ipNptvEt+JXUTFaQDZBEw BPiE8KlEUgd7JXgJ1IULKtjTmuHDs2bQlnt9RYWW4/h9BDOi7PsHMf39flz28N09Ygfg N5Zg== X-Gm-Message-State: APjAAAU03V7ZMkwEEQKZzO8U34aVcxEE/HItOit1dCLGVPL8oulujSOa oL0GordPISZS68SLm4EJ4Vs= X-Google-Smtp-Source: APXvYqycCaCo/VfSHAaSr/7bcSsO7mDmE0+3rkeIEkiyc8u+CJ60fHeoVFpQUedr6WmMBgDuv7ldtw== X-Received: by 2002:a05:6000:118e:: with SMTP id g14mr8677225wrx.39.1581421159922; Tue, 11 Feb 2020 03:39:19 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id z19sm3266657wmi.43.2020.02.11.03.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 03:39:19 -0800 (PST) From: luca.boccassi@gmail.com To: Tao Zhu Cc: Simei Su , Yahui Cao , Xiaolong Ye , dpdk stable Date: Tue, 11 Feb 2020 11:21:23 +0000 Message-Id: <20200211112216.3929-137-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com> References: <20200211112216.3929-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/ice: fix flow FDIR/switch memory leak' has been queued to stable release 19.11.1 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.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 02/13/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 a7c0db7df0db72d2f6acf064a41fdeabd7f7c957 Mon Sep 17 00:00:00 2001 From: Tao Zhu Date: Thu, 16 Jan 2020 16:38:36 +0000 Subject: [PATCH] net/ice: fix flow FDIR/switch memory leak [ upstream commit dc36bd5dfdeb0ec9cee7a6140d7ed14734776756 ] 1. Fix ice FDIR and hash flow memory leak. 2. Fix the ice definition of LIST_FOR_EACH_ENTRY_SAFE not save tmp which cause list deletion incompletely. Fixes: 5f0978e96220 ("net/ice/base: add OS specific implementation") Fixes: f5cafa961fae ("net/ice: add flow director create and destroy") Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS") Signed-off-by: Tao Zhu Reviewed-by: Simei Su Reviewed-by: Yahui Cao Acked-by: Xiaolong Ye --- drivers/net/ice/base/ice_osdep.h | 17 +++++++++++++++-- drivers/net/ice/ice_fdir_filter.c | 12 +++++++----- drivers/net/ice/ice_hash.c | 12 ++++++------ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h index 27c1830c5e..629acef227 100644 --- a/drivers/net/ice/base/ice_osdep.h +++ b/drivers/net/ice/base/ice_osdep.h @@ -343,6 +343,21 @@ static inline void list_add_tail(struct ice_list_entry *entry, member) : \ 0) +#define LIST_FOR_EACH_ENTRY_SAFE(pos, tmp, head, type, member) \ + for ((pos) = (head)->lh_first ? \ + container_of((head)->lh_first, struct type, member) : \ + 0, \ + (tmp) = (pos) == 0 ? 0 : ((pos)->member.next.le_next ? \ + container_of((pos)->member.next.le_next, struct type, \ + member) : \ + 0); \ + (pos); \ + (pos) = (tmp), \ + (tmp) = (pos) == 0 ? 0 : ((tmp)->member.next.le_next ? \ + container_of((pos)->member.next.le_next, struct type, \ + member) : \ + 0)) + #define LIST_REPLACE_INIT(list_head, head) do { \ (head)->lh_first = (list_head)->lh_first; \ INIT_LIST_HEAD(list_head); \ @@ -356,8 +371,6 @@ static inline void list_add_tail(struct ice_list_entry *entry, #define HLIST_DEL(entry) LIST_DEL(entry) #define HLIST_FOR_EACH_ENTRY(pos, head, type, member) \ LIST_FOR_EACH_ENTRY(pos, head, type, member) -#define LIST_FOR_EACH_ENTRY_SAFE(pos, tmp, head, type, member) \ - LIST_FOR_EACH_ENTRY(pos, head, type, member) #ifndef ICE_DBG_TRACE #define ICE_DBG_TRACE BIT_ULL(0) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 42b9628630..68af2f2e25 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -1939,23 +1939,25 @@ ice_fdir_parse(struct ice_adapter *ad, ret = ice_fdir_parse_pattern(ad, pattern, error, filter); if (ret) - return ret; + goto error; input_set = filter->input_set; if (!input_set || input_set & ~item->input_set_mask) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern, "Invalid input set"); - return -rte_errno; + ret = -rte_errno; + goto error; } ret = ice_fdir_parse_action(ad, actions, error, filter); if (ret) - return ret; + goto error; *meta = filter; - - return 0; +error: + rte_free(item); + return ret; } static struct ice_flow_parser ice_fdir_parser_os = { diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index b145a3f0d5..d891538bd4 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -409,7 +409,7 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad, void **meta, struct rte_flow_error *error) { - int ret = 0; + int ret = -rte_errno; struct ice_pattern_match_item *pattern_match_item; struct rss_meta *rss_meta_ptr; @@ -425,11 +425,11 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad, pattern_match_item = ice_search_pattern_match_item(pattern, array, array_len, error); if (!pattern_match_item) - return -rte_errno; + goto error; ret = ice_hash_check_inset(pattern, error); if (ret) - return -rte_errno; + goto error; /* Save protocol header to rss_meta. */ *meta = rss_meta_ptr; @@ -438,12 +438,12 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad, /* Check rss action. */ ret = ice_hash_parse_action(pattern_match_item, actions, meta, error); +error: if (ret) - return -rte_errno; - + rte_free(rss_meta_ptr); rte_free(pattern_match_item); - return 0; + return ret; } static int -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-11 11:17:43.444902256 +0000 +++ 0137-net-ice-fix-flow-FDIR-switch-memory-leak.patch 2020-02-11 11:17:38.648005984 +0000 @@ -1,8 +1,10 @@ -From dc36bd5dfdeb0ec9cee7a6140d7ed14734776756 Mon Sep 17 00:00:00 2001 +From a7c0db7df0db72d2f6acf064a41fdeabd7f7c957 Mon Sep 17 00:00:00 2001 From: Tao Zhu Date: Thu, 16 Jan 2020 16:38:36 +0000 Subject: [PATCH] net/ice: fix flow FDIR/switch memory leak +[ upstream commit dc36bd5dfdeb0ec9cee7a6140d7ed14734776756 ] + 1. Fix ice FDIR and hash flow memory leak. 2. Fix the ice definition of LIST_FOR_EACH_ENTRY_SAFE not save tmp which cause list deletion incompletely. @@ -10,7 +12,6 @@ Fixes: 5f0978e96220 ("net/ice/base: add OS specific implementation") Fixes: f5cafa961fae ("net/ice: add flow director create and destroy") Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS") -Cc: stable@dpdk.org Signed-off-by: Tao Zhu Reviewed-by: Simei Su @@ -23,10 +24,10 @@ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h -index 45b9f36177..a4a2994c76 100644 +index 27c1830c5e..629acef227 100644 --- a/drivers/net/ice/base/ice_osdep.h +++ b/drivers/net/ice/base/ice_osdep.h -@@ -345,6 +345,21 @@ static inline void list_add_tail(struct ice_list_entry *entry, +@@ -343,6 +343,21 @@ static inline void list_add_tail(struct ice_list_entry *entry, member) : \ 0) @@ -48,7 +49,7 @@ #define LIST_REPLACE_INIT(list_head, head) do { \ (head)->lh_first = (list_head)->lh_first; \ INIT_LIST_HEAD(list_head); \ -@@ -358,8 +373,6 @@ static inline void list_add_tail(struct ice_list_entry *entry, +@@ -356,8 +371,6 @@ static inline void list_add_tail(struct ice_list_entry *entry, #define HLIST_DEL(entry) LIST_DEL(entry) #define HLIST_FOR_EACH_ENTRY(pos, head, type, member) \ LIST_FOR_EACH_ENTRY(pos, head, type, member)