summary refs log tree commit diff stats
path: root/util/oslib-posix.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2022-01-11 13:08:30 +0100
committerMichael S. Tsirkin <mst@redhat.com>2022-02-06 04:33:50 -0500
commitdd4fc6058557cd2a9e23a37da44d054f724ca3e8 (patch)
treea7c4275a35858c3626088e75f192f535e22563ee /util/oslib-posix.c
parenta4752a51f1466be5010962c7044edaf763f419ef (diff)
downloadfocaccia-qemu-dd4fc6058557cd2a9e23a37da44d054f724ca3e8.tar.gz
focaccia-qemu-dd4fc6058557cd2a9e23a37da44d054f724ca3e8.zip
util/oslib-posix: Fix missing unlock in the error path of os_mem_prealloc()
We're missing an unlock in case installing the signal handler failed.
Fortunately, we barely see this error in real life.

Fixes: a960d6642d39 ("util/oslib-posix: Support concurrent os_mem_prealloc() invocation")
Fixes: CID 1468941
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Pankaj Gupta <pankaj.gupta@ionos.com>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20220111120830.119912-1-david@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'util/oslib-posix.c')
-rw-r--r--util/oslib-posix.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 9efdc74bba..ac0dbc2adc 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -683,6 +683,7 @@ void os_mem_prealloc(int fd, char *area, size_t memory, int smp_cpus,
 
         ret = sigaction(SIGBUS, &act, &sigbus_oldact);
         if (ret) {
+            qemu_mutex_unlock(&sigbus_mutex);
             error_setg_errno(errp, errno,
                 "os_mem_prealloc: failed to install signal handler");
             return;