Blame SOURCES/autofs-5.0.7-fix-use-cache-entry-after-free-mistake.patch

306fa1
autofs-5.0.7 - fix use cache entry after free mistake
306fa1
306fa1
From: Ian Kent <ikent@redhat.com>
306fa1
306fa1
Fix an obvious use after free mistake in lookup_prune_one_cache().
306fa1
---
306fa1
306fa1
 CHANGELOG       |    1 +
306fa1
 daemon/lookup.c |    7 +++++--
306fa1
 2 files changed, 6 insertions(+), 2 deletions(-)
306fa1
306fa1
306fa1
diff --git a/CHANGELOG b/CHANGELOG
306fa1
index faf4c80..dc38580 100644
306fa1
--- a/CHANGELOG
306fa1
+++ b/CHANGELOG
306fa1
@@ -1,6 +1,7 @@
306fa1
 ??/??/2012 autofs-5.0.8
306fa1
 =======================
306fa1
 - fix nobind sun escaped map entries.
306fa1
+- fix use cache entry after free in lookup_prune_one_cache().
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
diff --git a/daemon/lookup.c b/daemon/lookup.c
306fa1
index 7909536..e3d9536 100644
306fa1
--- a/daemon/lookup.c
306fa1
+++ b/daemon/lookup.c
306fa1
@@ -1103,15 +1103,18 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
306fa1
 		if (valid)
306fa1
 			cache_delete(mc, key);
306fa1
 		else if (!is_mounted(_PROC_MOUNTS, path, MNTS_AUTOFS)) {
306fa1
+			dev_t devid = ap->dev;
306fa1
 			status = CHE_FAIL;
306fa1
+			if (ap->type == LKP_DIRECT)
306fa1
+				devid = this->dev;
306fa1
 			if (this->ioctlfd == -1)
306fa1
 				status = cache_delete(mc, key);
306fa1
 			if (status != CHE_FAIL) {
306fa1
 				if (ap->type == LKP_INDIRECT) {
306fa1
 					if (ap->flags & MOUNT_FLAG_GHOST)
306fa1
-						rmdir_path(ap, path, ap->dev);
306fa1
+						rmdir_path(ap, path, devid);
306fa1
 				} else
306fa1
-					rmdir_path(ap, path, this->dev);
306fa1
+					rmdir_path(ap, path, devid);
306fa1
 			}
306fa1
 		}
306fa1
 		cache_unlock(mc);