From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 5737D1C684 for ; Fri, 13 Apr 2018 17:34:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2018 08:34:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,446,1517904000"; d="scan'208";a="47660367" Received: from tanjianf-mobl.ccr.corp.intel.com (HELO [10.255.29.166]) ([10.255.29.166]) by orsmga001.jf.intel.com with ESMTP; 13 Apr 2018 08:34:24 -0700 To: Anatoly Burakov , dev@dpdk.org References: From: "Tan, Jianfeng" Message-ID: <2bad2fa0-677e-29ed-23dc-2cfc7d848b9c@intel.com> Date: Fri, 13 Apr 2018 23:34:23 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 2/2] eal/ipc: fix use-after-free in asynchronous requests 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, 13 Apr 2018 15:34:27 -0000 On 4/13/2018 7:55 PM, Anatoly Burakov wrote: > Previously, we were removing request from the list only if we > have succeeded to send it. This resulted in leaving an invalid > pointer in the request list. > > Fix this by only adding new requests to the request list if we > have succeeded in sending them. > > Fixes: f05e26051c15 ("eal: add IPC asynchronous request") > Cc: anatoly.burakov@intel.com > > Signed-off-by: Anatoly Burakov Acked-by: Jianfeng Tan > --- > lib/librte_eal/common/eal_common_proc.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c > index e3eb430..a8ca7b8 100644 > --- a/lib/librte_eal/common/eal_common_proc.c > +++ b/lib/librte_eal/common/eal_common_proc.c > @@ -876,9 +876,7 @@ mp_request_async(const char *dst, struct rte_mp_msg *req, > /* queue already locked by caller */ > > exist = find_sync_request(dst, req->name); > - if (!exist) { > - TAILQ_INSERT_TAIL(&pending_requests.requests, sync_req, next); > - } else { > + if (exist) { > RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name); > rte_errno = EEXIST; > ret = -1; > @@ -895,6 +893,7 @@ mp_request_async(const char *dst, struct rte_mp_msg *req, > ret = 0; > goto fail; > } > + TAILQ_INSERT_TAIL(&pending_requests.requests, sync_req, next); > > param->user_reply.nb_sent++; >