diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2024-07-30 17:55:37 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-07-31 13:14:52 +0200 |
commit | 768a28394c9412fe1cfdf48509713fd11779a658 (patch) | |
tree | b4d21966b3c0a3bacd997aa72be49ad58aa6d852 | |
parent | 6e623af30130fce6e94c717176f3e3c9f2742b7d (diff) | |
download | qemu-768a28394c9412fe1cfdf48509713fd11779a658.zip qemu-768a28394c9412fe1cfdf48509713fd11779a658.tar.gz qemu-768a28394c9412fe1cfdf48509713fd11779a658.tar.bz2 |
qemu-vmsr-helper: fix socket loop breakage
Between v5 and v6 of the series, the socket loop of qemu-vmsr-helper was changed to
allow sending multiple requests on the same socket. Unfortunately, the condition
of the while loop is botched and the loop will never be entered. Clean it up, and
also unify the handling of error reporting.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | tools/i386/qemu-vmsr-helper.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/i386/qemu-vmsr-helper.c b/tools/i386/qemu-vmsr-helper.c index ebf562c..585eaf8 100644 --- a/tools/i386/qemu-vmsr-helper.c +++ b/tools/i386/qemu-vmsr-helper.c @@ -227,19 +227,17 @@ static void coroutine_fn vh_co_entry(void *opaque) &peer_pid, &local_err); if (r < 0) { - error_report_err(local_err); goto out; } - while (r < 0) { + for (;;) { /* * Read the requested MSR * Only RAPL MSR in rapl-msr-index.h is allowed */ - r = qio_channel_read_all(QIO_CHANNEL(client->ioc), - (char *) &request, sizeof(request), &local_err); - if (r < 0) { - error_report_err(local_err); + r = qio_channel_read_all_eof(QIO_CHANNEL(client->ioc), + (char *) &request, sizeof(request), &local_err); + if (r <= 0) { break; } @@ -261,11 +259,15 @@ static void coroutine_fn vh_co_entry(void *opaque) sizeof(vmsr), &local_err); if (r < 0) { - error_report_err(local_err); break; } } + out: + if (local_err) { + error_report_err(local_err); + } + object_unref(OBJECT(client->ioc)); g_free(client); } |