From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 7A6E34D3A for ; Thu, 1 Feb 2018 10:48:07 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 3377B2082E; Thu, 1 Feb 2018 04:48:07 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 01 Feb 2018 04:48:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=2RfzWuY+aQJnEQuV4 mVdulBMFEatc9H8buJCuxvDpXE=; b=vg/054YOGXoeibtrqVLW2NDCos9CTnjl1 8dZJEQkXsIr4BIYFS2rAP8iq+R+x31t7sv+wnLjLRvggmrYLXK9oe3g6F5Vgogv7 wjqWHNm6p/TamDMtwPDTearN2ahknIBMsUY01C5DGkpVx2ztcjPVmm+54HdBCLM/ HPEyMWlph05NLhJVLnyV2tEUr0b7YsfqNbJc0Lw5/ppas2e+JsLEyRU1bDu+in1l a/4I3ArFIzvTPX3NbkhZh9KvVdBygOpssDyFuOuftai5xmSK+QvAHs6NwpVrbqzK hgWch6mqCkYN3eZonSqC3NPWrAoTF3qDp3OOoXZAyhpLFX7Cgx//w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=2RfzWuY+aQJnEQuV4mVdulBMFEatc9H8buJCuxvDpXE=; b=dlJBO6Uu Iws1RcH9Q23va6oiVycm+k/udgoVcLAMJlswWi9MQ6jj6eWqZ45SxT4iaNI9AUA6 MKJtw6DXnlk91Shpt0JKoZSx91ofkDH3NdsZUTi7YONfajNrlsG4vLVBJJg2AM5I i8uAFwA2aPeHixQuCXImACyyZ6tiuUBbqneYhlLUYLvaW9IEkXmVYbJ/JdblUYkt k6i9kww5rfWcRE6j7PVGgIE38yybEOz5fu16rRJ50HL3vpdtjr6ktlAr9jozLhng mHiNabK/17LG2WDQCch9qVRCCgmHaJg1150UrqeIG7QtkrsO09aRe70xjhihbOaY YqWaPzvYN9ttBA== X-ME-Sender: Received: from yliu-mob.mtl.com (unknown [115.150.27.200]) by mail.messagingengine.com (Postfix) with ESMTPA id 2D157246D5; Thu, 1 Feb 2018 04:48:04 -0500 (EST) From: Yuanhan Liu To: Harry van Haaren Cc: Vipin Varghese , dpdk stable Date: Thu, 1 Feb 2018 17:47:16 +0800 Message-Id: <1517478479-12417-2-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517478479-12417-1-git-send-email-yliu@fridaylinux.org> References: <1517478479-12417-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'service: fix possible mem leak on initialize' has been queued to LTS release 17.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: Thu, 01 Feb 2018 09:48:07 -0000 Hi, FYI, your patch has been queued to LTS release 17.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/03/18. So please shout if anyone has objections. Thanks. --yliu --- >>From 0fddb7867cd952540da7a56c23ea7df82dca158a Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Wed, 24 Jan 2018 17:02:47 +0000 Subject: [PATCH] service: fix possible mem leak on initialize [ upstream commit da9ac508c3b77c83c201dd01d7736ccf139d1767 ] This commit ensures that if that if we run out of memory during the initialization of the service library, that the first allocated memory is correctly freed instead of leaked. Fixes: 21698354c832 ("service: introduce service cores concept") Reported-by: Vipin Varghese Signed-off-by: Harry van Haaren --- lib/librte_eal/common/rte_service.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index 9ff4136..1f92294 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -111,14 +111,14 @@ int32_t rte_service_init(void) RTE_CACHE_LINE_SIZE); if (!rte_services) { printf("error allocating rte services array\n"); - return -ENOMEM; + goto fail_mem; } lcore_states = rte_calloc("rte_service_core_states", RTE_MAX_LCORE, sizeof(struct core_state), RTE_CACHE_LINE_SIZE); if (!lcore_states) { printf("error allocating core states array\n"); - return -ENOMEM; + goto fail_mem; } int i; @@ -135,6 +135,12 @@ int32_t rte_service_init(void) rte_service_library_initialized = 1; return 0; +fail_mem: + if (rte_services) + rte_free(rte_services); + if (lcore_states) + rte_free(lcore_states); + return -ENOMEM; } /* returns 1 if service is registered and has not been unregistered -- 2.7.4