Skip to content

Commit

Permalink
pr-manager-helper: avoid SIGSEGV when writing to the socket fail
Browse files Browse the repository at this point in the history
When writing to the qemu-pr-helper socket failed, the persistent
reservation manager was correctly disconnecting the socket, but it
did not clear pr_mgr->ioc.  So the rest of the code did not know
that the socket had been disconnected, accessed pr_mgr->ioc and
happily caused a crash.

To reproduce, it is enough to stop qemu-pr-helper between QEMU
startup and executing e.g. sg_persist -k /dev/sdb.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed Jun 28, 2018
1 parent 86933b4 commit aad1004
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions scsi/pr-manager-helper.c
Expand Up @@ -71,6 +71,7 @@ static int pr_manager_helper_write(PRManagerHelper *pr_mgr,
if (n_written <= 0) {
assert(n_written != QIO_CHANNEL_ERR_BLOCK);
object_unref(OBJECT(pr_mgr->ioc));
pr_mgr->ioc = NULL;
return n_written < 0 ? -EINVAL : 0;
}

Expand Down

0 comments on commit aad1004

Please sign in to comment.