qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/4] virtiofsd: load_capng missing unlock


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 3/4] virtiofsd: load_capng missing unlock
Date: Tue, 4 Feb 2020 13:05:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Hi David,

On 2/4/20 12:05 PM, Dr. David Alan Gilbert (git) wrote:
From: "Dr. David Alan Gilbert" <address@hidden>

Missing unlock in error path.

Fixes: Covertiy CID 1413123
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
  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) {
             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,
---




reply via email to

[Prev in Thread] Current Thread [Next in Thread]