Blame SOURCES/autofs-5.1.7-dont-try-umount-after-stat-ENOENT-fail.patch

beb904
autofs-5.1.7 - dont try umount after stat() ENOENT fail
beb904
beb904
From: Ian Kent <raven@themaw.net>
beb904
beb904
Coverity: Calling function "umount" that uses "me->key" after a check
beb904
	  function. This can cause a time-of-check, time-of-use race
beb904
	  condition.
beb904
beb904
Signed-off-by: Ian Kent <raven@themaw.net>
beb904
---
beb904
 CHANGELOG       |    1 +
beb904
 daemon/direct.c |    6 +++++-
beb904
 2 files changed, 6 insertions(+), 1 deletion(-)
beb904
beb904
--- autofs-5.1.4.orig/CHANGELOG
beb904
+++ autofs-5.1.4/CHANGELOG
beb904
@@ -57,6 +57,7 @@
beb904
 - fix double unlock in parse_mount().
beb904
 - add length check in umount_subtree_mounts().
beb904
 - fix flags check in umount_multi().
beb904
+- dont try umount after stat() ENOENT fail.
beb904
 
beb904
 xx/xx/2018 autofs-5.1.5
beb904
 - fix flag file permission.
beb904
--- autofs-5.1.4.orig/daemon/direct.c
beb904
+++ autofs-5.1.4/daemon/direct.c
beb904
@@ -739,9 +739,13 @@ int mount_autofs_offset(struct autofs_po
beb904
 
beb904
 	ret = stat(me->key, &st);
beb904
 	if (ret == -1) {
beb904
+		int save_errno = errno;
beb904
+
beb904
 		error(ap->logopt,
beb904
 		     "failed to stat direct mount trigger %s", me->key);
beb904
-		goto out_umount;
beb904
+		if (save_errno != ENOENT)
beb904
+			goto out_umount;
beb904
+		goto out_err;
beb904
 	}
beb904
 
beb904
 	ops->open(ap->logopt, &ioctlfd, st.st_dev, me->key);