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

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