From: Paolo Bonzini Date: Thu, 27 Apr 2023 12:54:02 +0000 (+0200) Subject: tests: vhost-user-test: release mutex on protocol violation X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9260993e27cdbbd2e829d405cc63b1faefec6088;p=qemu.git 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 --- 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); }