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

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