Blame SOURCES/open-iscsi-2.0.876-31-Fix-iscsiuio-segfault-when-shutting-down.patch

36b27b
From: Chris Leech <cleech@redhat.com>
36b27b
Subject: Fix iscsiuio segfault when shutting down.
36b27b
36b27b
Bugzilla: ZZZ
36b27b
Upstream Status:
36b27b
Build Info: XXX
36b27b
Tested:
36b27b
36b27b
commit 2bdcae8a9969295183377342cfe218d1c5d263db
36b27b
Author: Lee Duncan <lduncan@suse.com>
36b27b
Date:   Thu May 31 08:42:58 2018 -0700
36b27b
36b27b
    Fix iscsiuio segfault when shutting down.
36b27b
    
36b27b
    If iscsiuio is stopped when first starting up, it can easily
36b27b
    hit a window where pthread_cancel() is called before pthread_create()
36b27b
    finishesx The problem was found by kiyo@jp.fujitsu.com, who also
36b27b
    proposed the fix.
36b27b
---
36b27b
 iscsiuio/src/unix/iscsid_ipc.c | 3 ++-
36b27b
 1 file changed, 2 insertions(+), 1 deletion(-)
36b27b
36b27b
diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
36b27b
index d4322350fcf6..2acac485af72 100644
36b27b
--- a/iscsiuio/src/unix/iscsid_ipc.c
36b27b
+++ b/iscsiuio/src/unix/iscsid_ipc.c
36b27b
@@ -1245,7 +1245,8 @@ void iscsid_cleanup()
36b27b
 {
36b27b
 	int rc;
36b27b
 
36b27b
-	if (iscsid_opts.fd != INVALID_FD) {
36b27b
+	if (iscsid_opts.fd != INVALID_FD &&
36b27b
+	    iscsid_opts.thread != INVALID_THREAD) {
36b27b
 		rc = pthread_cancel(iscsid_opts.thread);
36b27b
 		if (rc != 0) {
36b27b
 			LOG_ERR("Could not cancel iscsid listening thread: %s",