Blame SOURCES/sshfs-fix-premature-free.patch

d816ef
diff -ur sshfs-2.8.old/ChangeLog sshfs-2.8/ChangeLog
d816ef
--- sshfs-2.8.old/ChangeLog	2016-06-22 19:38:01.000000000 +0100
d816ef
+++ sshfs-2.8/ChangeLog	2021-09-07 08:17:35.352080786 +0100
d816ef
@@ -1,3 +1,9 @@
d816ef
+ Unreleased Changes
d816ef
+ ------------------
d816ef
+
d816ef
++* Fixed a crash due to a race condition when listing
d816ef
++  directory contents.
d816ef
+
d816ef
 Release 2.7 (2016-06-22)
d816ef
 ------------------------
d816ef
 
d816ef
diff -ur sshfs-2.8.old/sshfs.c sshfs-2.8/sshfs.c
d816ef
--- sshfs-2.8.old/sshfs.c	2016-06-08 16:42:12.000000000 +0100
d816ef
+++ sshfs-2.8/sshfs.c	2021-09-07 08:17:06.339682726 +0100
d816ef
@@ -2173,11 +2173,16 @@
d816ef
 			outstanding--;
d816ef
 
d816ef
 			if (done) {
d816ef
+				/* We need to cache want_reply, since processing
d816ef
+				   thread may free req right after unlock() if
d816ef
+				   want_reply == 0 */
d816ef
+				int want_reply;
d816ef
 				pthread_mutex_lock(&sshfs.lock);
d816ef
 				if (sshfs_req_pending(req))
d816ef
 					req->want_reply = 0;
d816ef
+				want_reply = req->want_reply;
d816ef
 				pthread_mutex_unlock(&sshfs.lock);
d816ef
-				if (!req->want_reply)
d816ef
+				if (!want_reply)
d816ef
 					continue;
d816ef
 			}
d816ef