qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [PATCH 3/4] virtiofsd: load_capng missing unlock
Date: Tue, 4 Feb 2020 17:06:30 +0100	[thread overview]
Message-ID: <45f090c8-2ffc-6a47-39d6-54df6672b9f3@redhat.com> (raw)
In-Reply-To: <20200204154404.GE3504@work-vm>

On 2/4/20 4:44 PM, Dr. David Alan Gilbert wrote:
> * Philippe Mathieu-Daudé (philmd@redhat.com) wrote:
>> Hi David,
>>
>> On 2/4/20 12:05 PM, Dr. David Alan Gilbert (git) wrote:
>>> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>>>
>>> Missing unlock in error path.
>>>
>>> Fixes: Covertiy CID 1413123
>>> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>>> ---
>>>    tools/virtiofsd/passthrough_ll.c | 1 +
>>>    1 file changed, 1 insertion(+)
>>>
>>> diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
>>> index e6f2399efc..c635fc8820 100644
>>> --- a/tools/virtiofsd/passthrough_ll.c
>>> +++ b/tools/virtiofsd/passthrough_ll.c
>>> @@ -232,6 +232,7 @@ static int load_capng(void)
>>>             */
>>>            cap.saved = capng_save_state();
>>>            if (!cap.saved) {
>>> +            pthread_mutex_unlock(&cap.mutex);
>>>                fuse_log(FUSE_LOG_ERR, "capng_save_state (thread)\n");
>>>                return -EINVAL;
>>>            }
>>>
>>
>> What about moving the unlock call?
>>
>> -- >8 --
>> --- a/tools/virtiofsd/passthrough_ll.c
>> +++ b/tools/virtiofsd/passthrough_ll.c
>> @@ -231,11 +231,11 @@ static int load_capng(void)
>>            * so make another.
>>            */
>>           cap.saved = capng_save_state();
>> +        pthread_mutex_unlock(&cap.mutex);
>>           if (!cap.saved) {
> 
> I don't think I can legally check cap.saved there if I've already
> unlocked

Sorry I was with low sugar... I read it as a copy.

The patch is fine:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> 
>>               fuse_log(FUSE_LOG_ERR, "capng_save_state (thread)\n");
>>               return -EINVAL;
>>           }
>> -        pthread_mutex_unlock(&cap.mutex);
>>
>>           /*
>>            * We want to use the loaded state for our pid,
>> ---
>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> 
> 



  reply	other threads:[~2020-02-04 16:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 11:04 [PATCH 0/4] virtiofsd coverity fixes Dr. David Alan Gilbert (git)
2020-02-04 11:04 ` [PATCH 1/4] virtiofsd: Remove fuse_req_getgroups Dr. David Alan Gilbert (git)
2020-02-04 11:59   ` Philippe Mathieu-Daudé
2020-02-04 11:04 ` [PATCH 2/4] virtiofsd: fv_create_listen_socket error path socket leak Dr. David Alan Gilbert (git)
2020-02-04 12:00   ` Philippe Mathieu-Daudé
2020-02-04 11:05 ` [PATCH 3/4] virtiofsd: load_capng missing unlock Dr. David Alan Gilbert (git)
2020-02-04 12:05   ` Philippe Mathieu-Daudé
2020-02-04 15:44     ` Dr. David Alan Gilbert
2020-02-04 16:06       ` Philippe Mathieu-Daudé [this message]
2020-02-04 11:05 ` [PATCH 4/4] virtiofsd: do_read missing NULL check Dr. David Alan Gilbert (git)
2020-02-04 12:03   ` Philippe Mathieu-Daudé
2020-02-05 14:31 ` [PATCH 0/4] virtiofsd coverity fixes Stefan Hajnoczi

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=45f090c8-2ffc-6a47-39d6-54df6672b9f3@redhat.com \
    --to=philmd@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).