From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7B84B4C99; Fri, 26 Oct 2018 16:22:21 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Oct 2018 07:22:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,428,1534834800"; d="scan'208";a="81136552" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.252.8.177]) ([10.252.8.177]) by fmsmga007.fm.intel.com with ESMTP; 26 Oct 2018 07:22:19 -0700 To: Darek Stojaczyk , dev@dpdk.org Cc: qi.z.zhang@intel.com, stable@dpdk.org References: <20181025104619.137205-1-dariusz.stojaczyk@intel.com> From: "Burakov, Anatoly" Message-ID: Date: Fri, 26 Oct 2018 15:22:18 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181025104619.137205-1-dariusz.stojaczyk@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] eal: fix rte_mp_request_sync() memleak on device hotplug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 14:22:22 -0000 On 25-Oct-18 11:46 AM, Darek Stojaczyk wrote: > rte_mp_request_sync() says that the caller is responsible > for freeing one of its parameters afterwards. EAL didn't > do that, causing a memory leak. > > Fixes: 244d5130719c ("eal: enable hotplug on multi-process") > Cc: qi.z.zhang@intel.com > Cc: stable@dpdk.org > > Signed-off-by: Darek Stojaczyk > --- > lib/librte_eal/common/hotplug_mp.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c > index 84f59d95b..9a6a88546 100644 > --- a/lib/librte_eal/common/hotplug_mp.c > +++ b/lib/librte_eal/common/hotplug_mp.c > @@ -355,6 +355,7 @@ int eal_dev_hotplug_request_to_primary(struct eal_dev_mp_req *req) > resp = (struct eal_dev_mp_req *)mp_reply.msgs[0].param; > req->result = resp->result; > > + free(mp_reply.msgs); > return ret; > } > > @@ -397,6 +398,7 @@ int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req) > } > } > > + free(mp_reply.msgs); > return 0; > } > > This is correct but incomplete. There are also numerous error conditions which check for number of received responses to be a particular number, and if the number don't match, we just exit without freeing memory. Those errors need to free the memory as well. -- Thanks, Anatoly