summaryrefslogtreecommitdiffstats
path: root/scsi
diff options
context:
space:
mode:
authorPaolo Bonzini2018-06-26 15:39:18 +0200
committerPaolo Bonzini2018-06-28 19:05:35 +0200
commitaad10040d411d21542dc9ae58a2854c89ccedd78 (patch)
tree22f095148df48091b0b7633a5a9884028804ec29 /scsi
parentpr-helper: fix assertion failure on failed multipath PERSISTENT RESERVE IN (diff)
downloadqemu-aad10040d411d21542dc9ae58a2854c89ccedd78.tar.gz
qemu-aad10040d411d21542dc9ae58a2854c89ccedd78.tar.xz
qemu-aad10040d411d21542dc9ae58a2854c89ccedd78.zip
pr-manager-helper: avoid SIGSEGV when writing to the socket fail
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>
Diffstat (limited to 'scsi')
-rw-r--r--scsi/pr-manager-helper.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c
index 82ff6b6123..0c0fe389b7 100644
--- a/scsi/pr-manager-helper.c
+++ b/scsi/pr-manager-helper.c
@@ -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;
}