diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2023-04-27 14:54:23 +0200 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2023-04-28 08:05:37 +0200 |
commit | 3ee7f21ed292966f5cd3eb71aa06f8ffc0e5ae41 (patch) | |
tree | a6c8d6877336f0e4e7b427f79161fb23622072c0 /tests | |
parent | e017462db554bedd82fa3bb86cd72d9e38684dd4 (diff) | |
download | qemu-3ee7f21ed292966f5cd3eb71aa06f8ffc0e5ae41.zip qemu-3ee7f21ed292966f5cd3eb71aa06f8ffc0e5ae41.tar.gz qemu-3ee7f21ed292966f5cd3eb71aa06f8ffc0e5ae41.tar.bz2 |
tests: vhost-user-test: release mutex on protocol violation
chr_read() is printing an error message and returning with s->data_mutex taken.
This can potentially cause a hang. Reported by Coverity.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20230427125423.103536-1-pbonzini@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/vhost-user-test.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index bf9f7c4..e4f95b2 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -351,7 +351,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) if (size != msg.size) { qos_printf("%s: Wrong message size received %d != %d\n", __func__, size, msg.size); - return; + goto out; } } @@ -509,6 +509,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) break; } +out: g_mutex_unlock(&s->data_mutex); } |