From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id A7133A0096 for ; Mon, 6 May 2019 15:14:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A32322E83; Mon, 6 May 2019 15:14:51 +0200 (CEST) Received: from mail-vs1-f65.google.com (mail-vs1-f65.google.com [209.85.217.65]) by dpdk.org (Postfix) with ESMTP id 9D3A12E83 for ; Mon, 6 May 2019 15:14:49 +0200 (CEST) Received: by mail-vs1-f65.google.com with SMTP id b23so8108795vso.1 for ; Mon, 06 May 2019 06:14:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aEM6joCuZnULL8FV2w3oRpcSYtE+hjhnlHmSjhstr20=; b=J5k8weCymwLaaNlN3xIRNtLIEDoDgQBJNuw1h6W/elonrN9hWf4WEb0XwO567j8UPY ohKtKswXW7i1HKubMDLV95Fyj7DGF5sPhIhmre1oMUEMk8RPymtRjRb3HYVXlakbXIwR 0ZgNRf/Rzdt0+DXp0Jej29jfthPaa1nSR6+6DZEsvP2kY28+vO451m5y9/NTUsuLfpdR cg3HUZJ6B+XI9HYQO9u5Wg4ik+Mh+U9E9vkM3JqCRD9D+++PoYtzhH1m2qRiwDP685jE rYYzFfzQipixvfozB/++FKP0FJezGfwK7ul/gR+eUb8aSKRelC3MyRcWQyLlkvuNOxes clCw== X-Gm-Message-State: APjAAAVBh2sDuDmpQY4UJJoiURHD6GiFt4o4zotEFfHv6QzRR7RETnsg GzKuyY2yo4Wu5hj5UlSqneYdDWWt5Q+Pwz+F64HmFw== X-Google-Smtp-Source: APXvYqz3qhFsVF5WSVZj65oakLY2ZUNoV4X0gYySR+4SVLxIg9oF6xO+YyuuHH3IgmBH7sJb4tCNwj33ftm5RoTBMGo= X-Received: by 2002:a67:a446:: with SMTP id p6mr13240037vsh.198.1557148488885; Mon, 06 May 2019 06:14:48 -0700 (PDT) MIME-Version: 1.0 References: <20190506131120.25140-1-aconole@redhat.com> In-Reply-To: <20190506131120.25140-1-aconole@redhat.com> From: David Marchand Date: Mon, 6 May 2019 15:14:37 +0200 Message-ID: To: Aaron Conole Cc: dev , Herakliusz Lipiec , dpdk stable , Anatoly Burakov Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] ipc: unlock on failure 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190506131437.7SJGTsFRHfRLekmJbKdN0oPI3i5Ja8MYwswxSM4yOY4@z> On Mon, May 6, 2019 at 3:11 PM Aaron Conole wrote: > Reported by Coverity. > > Fixes: a2a06860b8c4 ("ipc: fix memory leak on request failure") > Cc: Herakliusz Lipiec > Cc: stable@dpdk.org > Cc: Anatoly Burakov > Signed-off-by: Aaron Conole > --- > lib/librte_eal/common/eal_common_proc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/eal_common_proc.c > b/lib/librte_eal/common/eal_common_proc.c > index d23728604..3498e6b07 100644 > --- a/lib/librte_eal/common/eal_common_proc.c > +++ b/lib/librte_eal/common/eal_common_proc.c > @@ -1005,8 +1005,10 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct > rte_mp_reply *reply, > /* unlocks the mutex while waiting for response, > * locks on receive > */ > - if (mp_request_sync(path, req, reply, &end)) > + if (mp_request_sync(path, req, reply, &end)) { > + pthread_mutex_unlock(&pending_requests.lock); > goto err; > + } > } > pthread_mutex_unlock(&pending_requests.lock); > /* unlock the directory */ > -- > 2.19.1 > Unfortunately, I think this is more complex than this. We will leave a flock() pending and leak some resources from opendir(). -- David Marchand