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

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