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

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