diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2023-04-27 14:54:02 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-04-28 15:56:41 +0200 |
| commit | 9260993e27cdbbd2e829d405cc63b1faefec6088 (patch) | |
| tree | e723f8c31f591ba1ac4a1595998c0ed9ee9f14bc | |
| parent | c5c0fdbe39aa2f65fecd93ab3082b1b8a7e2a318 (diff) | |
| download | focaccia-qemu-9260993e27cdbbd2e829d405cc63b1faefec6088.tar.gz focaccia-qemu-9260993e27cdbbd2e829d405cc63b1faefec6088.zip | |
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>
Diffstat (limited to '')
| -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 bf9f7c4248..e4f95b2858 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); } |