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 E08FC326C for ; Tue, 20 Nov 2018 20:14:25 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E1FE307D847; Tue, 20 Nov 2018 19:14:25 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31AD7601A5; Tue, 20 Nov 2018 19:14:24 +0000 (UTC) From: Kevin Traynor To: Tiwei Bie Cc: Anatoly Burakov , dpdk stable Date: Tue, 20 Nov 2018 19:11:54 +0000 Message-Id: <20181120191252.30277-4-ktraynor@redhat.com> In-Reply-To: <20181120191252.30277-1-ktraynor@redhat.com> References: <20181120191252.30277-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 20 Nov 2018 19:14:25 +0000 (UTC) Subject: [dpdk-stable] patch 'malloc: fix potential null pointer dereference' has been queued to stable release 18.08.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: Tue, 20 Nov 2018 19:14:26 -0000 Hi, FYI, your patch has been queued to stable release 18.08.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 11/23/18. 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. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From 39c49c0cb3b7ce8307d31155c0ae2bf9ce754577 Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Wed, 15 Aug 2018 15:20:15 +0800 Subject: [PATCH] malloc: fix potential null pointer dereference [ upstream commit dde37a8fb86dd66b81378255f2c9dfe0c9b2cec9 ] We need to do the NULL pointer check first after malloc(). Fixes: 07dcbfe0101f ("malloc: support multiprocess memory hotplug") Signed-off-by: Tiwei Bie Acked-by: Anatoly Burakov --- lib/librte_eal/common/malloc_heap.c | 4 +--- lib/librte_eal/common/malloc_mp.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c index 12aaf2d72..ac7bbb3ba 100644 --- a/lib/librte_eal/common/malloc_heap.c +++ b/lib/librte_eal/common/malloc_heap.c @@ -327,9 +327,7 @@ try_expand_heap_primary(struct malloc_heap *heap, uint64_t pg_sz, /* we can't know in advance how many pages we'll need, so we malloc */ ms = malloc(sizeof(*ms) * n_segs); - - memset(ms, 0, sizeof(*ms) * n_segs); - if (ms == NULL) return -1; + memset(ms, 0, sizeof(*ms) * n_segs); elem = alloc_pages_on_heap(heap, pg_sz, elt_size, socket, flags, align, diff --git a/lib/librte_eal/common/malloc_mp.c b/lib/librte_eal/common/malloc_mp.c index 931c14bc5..5f2d4e0be 100644 --- a/lib/librte_eal/common/malloc_mp.c +++ b/lib/librte_eal/common/malloc_mp.c @@ -195,11 +195,9 @@ handle_alloc_request(const struct malloc_mp_req *m, /* we can't know in advance how many pages we'll need, so we malloc */ ms = malloc(sizeof(*ms) * n_segs); - - memset(ms, 0, sizeof(*ms) * n_segs); - if (ms == NULL) { RTE_LOG(ERR, EAL, "Couldn't allocate memory for request state\n"); goto fail; } + memset(ms, 0, sizeof(*ms) * n_segs); elem = alloc_pages_on_heap(heap, ar->page_sz, ar->elt_size, ar->socket, -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-20 17:53:07.574301709 +0000 +++ 0004-malloc-fix-potential-null-pointer-dereference.patch 2018-11-20 17:53:07.000000000 +0000 @@ -1,12 +1,13 @@ -From dde37a8fb86dd66b81378255f2c9dfe0c9b2cec9 Mon Sep 17 00:00:00 2001 +From 39c49c0cb3b7ce8307d31155c0ae2bf9ce754577 Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Wed, 15 Aug 2018 15:20:15 +0800 Subject: [PATCH] malloc: fix potential null pointer dereference +[ upstream commit dde37a8fb86dd66b81378255f2c9dfe0c9b2cec9 ] + We need to do the NULL pointer check first after malloc(). Fixes: 07dcbfe0101f ("malloc: support multiprocess memory hotplug") -Cc: stable@dpdk.org Signed-off-by: Tiwei Bie Acked-by: Anatoly Burakov