From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 29AF71B489 for ; Fri, 4 Jan 2019 14:27:37 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 87C3012E4E9; Fri, 4 Jan 2019 13:27:36 +0000 (UTC) Received: from ktraynor.remote.csb (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E3F45C1A1; Fri, 4 Jan 2019 13:27:34 +0000 (UTC) From: Kevin Traynor To: Honnappa Nagarahalli Cc: Steve Capper , Gavin Hu , Bruce Richardson , dpdk stable Date: Fri, 4 Jan 2019 13:24:23 +0000 Message-Id: <20190104132455.15170-41-ktraynor@redhat.com> In-Reply-To: <20190104132455.15170-1-ktraynor@redhat.com> References: <20190104132455.15170-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 04 Jan 2019 13:27:36 +0000 (UTC) Subject: [dpdk-stable] patch 'hash: fix out-of-bound write while freeing key slot' has been queued to LTS release 18.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: , X-List-Received-Date: Fri, 04 Jan 2019 13:27:37 -0000 Hi, FYI, your patch has been queued to LTS release 18.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 01/11/19. 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. Kevin Traynor --- >>From 6e4d89018954338778ea1c88bd4c9019c8900a73 Mon Sep 17 00:00:00 2001 From: Honnappa Nagarahalli Date: Wed, 21 Nov 2018 20:51:56 -0600 Subject: [PATCH] hash: fix out-of-bound write while freeing key slot [ upstream commit d5c677db89cc1e6113d55d8bf2300ec8b5f2d383 ] Add a debug check for out-of-bound write while freeing the key slot. Coverity issue: 325733 Fixes: e605a1d36ca7 ("hash: add lock-free r/w concurrency") Signed-off-by: Honnappa Nagarahalli Reviewed-by: Steve Capper Reviewed-by: Gavin Hu Acked-by: Bruce Richardson --- lib/librte_hash/rte_cuckoo_hash.c | 4 ++++ lib/librte_hash/rte_cuckoo_hash.h | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c index 7e6c139d3..c01489ba5 100644 --- a/lib/librte_hash/rte_cuckoo_hash.c +++ b/lib/librte_hash/rte_cuckoo_hash.c @@ -1348,4 +1348,7 @@ remove_entry(const struct rte_hash *h, struct rte_hash_bucket *bkt, unsigned i) cached_free_slots->objs, LCORE_CACHE_SIZE, NULL); + ERR_IF_TRUE((n_slots == 0), + "%s: could not enqueue free slots in global ring\n", + __func__); cached_free_slots->len -= n_slots; } @@ -1553,4 +1556,5 @@ rte_hash_free_key_with_position(const struct rte_hash *h, cached_free_slots->objs, LCORE_CACHE_SIZE, NULL); + RETURN_IF_TRUE((n_slots == 0), -EFAULT); cached_free_slots->len -= n_slots; } diff --git a/lib/librte_hash/rte_cuckoo_hash.h b/lib/librte_hash/rte_cuckoo_hash.h index 5dfbbc48b..eacdaa8d4 100644 --- a/lib/librte_hash/rte_cuckoo_hash.h +++ b/lib/librte_hash/rte_cuckoo_hash.h @@ -30,4 +30,15 @@ #endif +#if defined(RTE_LIBRTE_HASH_DEBUG) +#define ERR_IF_TRUE(cond, fmt, args...) do { \ + if (cond) { \ + RTE_LOG(ERR, HASH, fmt, ##args); \ + return; \ + } \ +} while (0) +#else +#define ERR_IF_TRUE(cond, fmt, args...) +#endif + #include #include -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-04 13:23:08.425985550 +0000 +++ 0041-hash-fix-out-of-bound-write-while-freeing-key-slot.patch 2019-01-04 13:23:07.000000000 +0000 @@ -1,13 +1,14 @@ -From d5c677db89cc1e6113d55d8bf2300ec8b5f2d383 Mon Sep 17 00:00:00 2001 +From 6e4d89018954338778ea1c88bd4c9019c8900a73 Mon Sep 17 00:00:00 2001 From: Honnappa Nagarahalli Date: Wed, 21 Nov 2018 20:51:56 -0600 Subject: [PATCH] hash: fix out-of-bound write while freeing key slot +[ upstream commit d5c677db89cc1e6113d55d8bf2300ec8b5f2d383 ] + Add a debug check for out-of-bound write while freeing the key slot. Coverity issue: 325733 Fixes: e605a1d36ca7 ("hash: add lock-free r/w concurrency") -Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli Reviewed-by: Steve Capper