From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by dpdk.org (Postfix) with ESMTP id E1CEF4CB3 for ; Tue, 14 Aug 2018 13:14:15 +0200 (CEST) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=lap.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpXAg-0000wO-3b; Tue, 14 Aug 2018 11:07:30 +0000 From: Christian Ehrhardt To: Harry van Haaren Cc: Jerin Jacob , dpdk stable Date: Tue, 14 Aug 2018 13:06:40 +0200 Message-Id: <20180814110651.25277-37-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180814110651.25277-1-christian.ehrhardt@canonical.com> References: <20180814110651.25277-1-christian.ehrhardt@canonical.com> Subject: [dpdk-stable] patch 'event: fix ring init failure handling' has been queued to stable release 18.05.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, 14 Aug 2018 11:14:16 -0000 Hi, FYI, your patch has been queued to stable release 18.05.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 08/16/18. So please shout if anyone has objections. Thanks. Christian Ehrhardt --- >>From 3ecf5f23f9e6ddbeb50f2384e673a9ffa6a932fa Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Thu, 2 Aug 2018 15:43:29 +0100 Subject: [PATCH] event: fix ring init failure handling [ upstream commit 219ae4a12995e5a8ee5e184655a37dd4ee96bf25 ] This commit fixes a bug in a 32-bit environment where the generic ring_init() would fail, but given the interaction with memzones the next iteration of the event_ring_autotest would actually *pass* because the ring in question would exist already an be looked-up. This commit rightly error checks the result of ring_init(), and calls rte_free() on the memory as required. Fixes: dc39e2f359b5 ("eventdev: add ring structure for events") Signed-off-by: Harry van Haaren Acked-by: Jerin Jacob --- lib/librte_eventdev/rte_event_ring.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/librte_eventdev/rte_event_ring.c b/lib/librte_eventdev/rte_event_ring.c index eb67751dc..16d02a953 100644 --- a/lib/librte_eventdev/rte_event_ring.c +++ b/lib/librte_eventdev/rte_event_ring.c @@ -82,11 +82,16 @@ rte_event_ring_create(const char *name, unsigned int count, int socket_id, mz = rte_memzone_reserve(mz_name, ring_size, socket_id, mz_flags); if (mz != NULL) { r = mz->addr; - /* - * no need to check return value here, we already checked the - * arguments above - */ - rte_event_ring_init(r, name, requested_count, flags); + /* Check return value in case rte_ring_init() fails on size */ + int err = rte_event_ring_init(r, name, requested_count, flags); + if (err) { + RTE_LOG(ERR, RING, "Ring init failed\n"); + if (rte_memzone_free(mz) != 0) + RTE_LOG(ERR, RING, "Cannot free memzone\n"); + rte_free(te); + rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + return NULL; + } te->data = (void *) r; r->r.memzone = mz; -- 2.17.1