Blame SOURCES/kvm-pr-manager-helper-avoid-SIGSEGV-when-writing-to-the-.patch

1bdc94
From 6bd996ee8e67d32215526016b84631147d065b7b Mon Sep 17 00:00:00 2001
1bdc94
From: Paolo Bonzini <pbonzini@redhat.com>
1bdc94
Date: Fri, 6 Jul 2018 17:56:53 +0200
1bdc94
Subject: [PATCH 19/89] pr-manager-helper: avoid SIGSEGV when writing to the
1bdc94
 socket fail
1bdc94
1bdc94
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
1bdc94
Message-id: <20180706175659.30615-4-pbonzini@redhat.com>
1bdc94
Patchwork-id: 81245
1bdc94
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 3/9] pr-manager-helper: avoid SIGSEGV when writing to the socket fail
1bdc94
Bugzilla: 1533158
1bdc94
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
1bdc94
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
1bdc94
RH-Acked-by: Michal Privoznik <mprivozn@redhat.com>
1bdc94
1bdc94
When writing to the qemu-pr-helper socket failed, the persistent
1bdc94
reservation manager was correctly disconnecting the socket, but it
1bdc94
did not clear pr_mgr->ioc.  So the rest of the code did not know
1bdc94
that the socket had been disconnected, accessed pr_mgr->ioc and
1bdc94
happily caused a crash.
1bdc94
1bdc94
To reproduce, it is enough to stop qemu-pr-helper between QEMU
1bdc94
startup and executing e.g. sg_persist -k /dev/sdb.
1bdc94
1bdc94
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
1bdc94
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1bdc94
(cherry picked from commit aad10040d411d21542dc9ae58a2854c89ccedd78)
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 scsi/pr-manager-helper.c | 1 +
1bdc94
 1 file changed, 1 insertion(+)
1bdc94
1bdc94
diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c
1bdc94
index 82ff6b6..0c0fe38 100644
1bdc94
--- a/scsi/pr-manager-helper.c
1bdc94
+++ b/scsi/pr-manager-helper.c
1bdc94
@@ -71,6 +71,7 @@ static int pr_manager_helper_write(PRManagerHelper *pr_mgr,
1bdc94
         if (n_written <= 0) {
1bdc94
             assert(n_written != QIO_CHANNEL_ERR_BLOCK);
1bdc94
             object_unref(OBJECT(pr_mgr->ioc));
1bdc94
+            pr_mgr->ioc = NULL;
1bdc94
             return n_written < 0 ? -EINVAL : 0;
1bdc94
         }
1bdc94
 
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94