Blame SOURCES/autofs-5.1.1-fix-rwlock-unlock-crash.patch

306fa1
autofs-5.1.1 - fix rwlock unlock crash
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
It should be the case that the only way that automount can exit
306fa1
the kernel communication read loop is after reading a packet and
306fa1
performing shutdown operations.
306fa1
306fa1
However there are reports of pthread_rwlock_unlock() being called
306fa1
from the exit cleanup function when the lock it is trying to unlock
306fa1
is not held.
306fa1
306fa1
But the call to the cleanup function is outside the communication
306fa1
loop so call it from each of the loop break points instead so that
306fa1
the expected locks must be held.
306fa1
306fa1
Signed-off-by: Ian Kent <raven@themaw.net>
306fa1
---
306fa1
 CHANGELOG          |    1 +
306fa1
 daemon/automount.c |    7 ++++---
306fa1
 2 files changed, 5 insertions(+), 3 deletions(-)
306fa1
306fa1
--- autofs-5.0.7.orig/CHANGELOG
306fa1
+++ autofs-5.0.7/CHANGELOG
306fa1
@@ -188,6 +188,7 @@
306fa1
 - fix typo in autofs.conf.
306fa1
 - always set direct mounts catatonic at exit.
306fa1
 - log pipe read errors.
306fa1
+- fix rwlock unlock crash.
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
--- autofs-5.0.7.orig/daemon/automount.c
306fa1
+++ autofs-5.0.7/daemon/automount.c
306fa1
@@ -1773,6 +1773,7 @@ void *handle_mounts(void *arg)
306fa1
 			 */
306fa1
 			if (ap->type == LKP_DIRECT) {
306fa1
 				umount_autofs(ap, NULL, 1);
306fa1
+				handle_mounts_cleanup(ap);
306fa1
 				break;
306fa1
 			}
306fa1
 
306fa1
@@ -1783,8 +1784,10 @@ void *handle_mounts(void *arg)
306fa1
 			 * occurs while we're trying to umount.
306fa1
 			 */
306fa1
 			ret = umount_autofs(ap, NULL, 1);
306fa1
-			if (!ret)
306fa1
+			if (!ret) {
306fa1
+				handle_mounts_cleanup(ap);
306fa1
 				break;
306fa1
+			}
306fa1
 
306fa1
 			/* Failed shutdown returns to ready */
306fa1
 			warn(ap->logopt,
306fa1
@@ -1805,8 +1808,6 @@ void *handle_mounts(void *arg)
306fa1
 		}
306fa1
 	}
306fa1
 
306fa1
-	handle_mounts_cleanup(ap);
306fa1
-
306fa1
 	return NULL;
306fa1
 }
306fa1