DPDK patches and discussions
 help / color / mirror / Atom feed
From: Aaron Conole <aconole@redhat.com>
To: David Marchand <david.marchand@redhat.com>
Cc: dev <dev@dpdk.org>,
	Herakliusz Lipiec <herakliusz.lipiec@intel.com>,
	dpdk stable <stable@dpdk.org>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: Re: [dpdk-dev] [PATCH] ipc: unlock on failure
Date: Mon, 06 May 2019 09:22:08 -0400	[thread overview]
Message-ID: <f7tmujziupr.fsf@dhcp-25.97.bos.redhat.com> (raw)
Message-ID: <20190506132208.a2YH3LK8MOBDIDT0GN8UAMlhLf1W_3vFyXt2KN_CYGA@z> (raw)
In-Reply-To: <CAJFAV8yFuKegFrmf4WHQRoCEV78RNqOZi_Oy02cMk8Rf+=z2GA@mail.gmail.com> (David Marchand's message of "Mon, 6 May 2019 15:14:37 +0200")

David Marchand <david.marchand@redhat.com> writes:

> On Mon, May 6, 2019 at 3:11 PM Aaron Conole <aconole@redhat.com> wrote:
>
>  Reported by Coverity.
>
>  Fixes: a2a06860b8c4 ("ipc: fix memory leak on request failure")
>  Cc: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
>  Cc: stable@dpdk.org
>  Cc: Anatoly Burakov <anatoly.burakov@intel.com>
>  Signed-off-by: Aaron Conole <aconole@redhat.com>
>  ---
>   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().

I completely forgot about it, while double checking the mp_request_sync

You're right, we leak the dirfd, still.

Okay, I think see a better way to write this.

  parent reply	other threads:[~2019-05-06 13:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 13:11 Aaron Conole
2019-05-06 13:11 ` Aaron Conole
2019-05-06 13:14 ` David Marchand
2019-05-06 13:14   ` David Marchand
2019-05-06 13:22   ` Aaron Conole [this message]
2019-05-06 13:22     ` Aaron Conole
2019-05-06 13:48 ` [dpdk-dev] [PATCH v2] " Aaron Conole
2019-05-06 13:48   ` Aaron Conole
2019-05-06 14:02   ` David Marchand
2019-05-06 14:02     ` David Marchand
2019-05-08 14:24   ` Stojaczyk, Dariusz
2019-05-08 14:24     ` Stojaczyk, Dariusz
2019-05-09 11:50   ` Burakov, Anatoly
2019-05-09 11:50     ` Burakov, Anatoly
2019-05-09 14:31     ` Thomas Monjalon
2019-05-09 14:31       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7tmujziupr.fsf@dhcp-25.97.bos.redhat.com \
    --to=aconole@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=herakliusz.lipiec@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).