Blame SOURCES/autofs-5.0.7-recheck-valid-map-entry-lookup-return-in-do_readmap_mount.patch

304803
autofs-5.0.7 - recheck valid map entry lookup return in do_readmap_mount()
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
After looking for an expected existing valid map entry in do_readmap_mount()
304803
add a check in case it isn't found.
304803
304803
If it actually isn't found (although it always should be) the only thing
304803
that can be done is log an error return.
304803
---
304803
 daemon/state.c |    6 ++++++
304803
 1 file changed, 6 insertions(+)
304803
304803
diff --git a/daemon/state.c b/daemon/state.c
304803
index 6e23022..ddc5556 100644
304803
--- a/daemon/state.c
304803
+++ b/daemon/state.c
304803
@@ -405,6 +405,12 @@ static void do_readmap_mount(struct autofs_point *ap, struct mnt_list *mnts,
304803
 			     me->key);
304803
 			cache_writelock(vmc);
304803
 			valid = cache_lookup_distinct(vmc, me->key);
304803
+			if (!valid) {
304803
+				cache_unlock(vmc);
304803
+				error(ap->logopt,
304803
+				     "failed to find expected existing valid map entry");
304803
+				return;
304803
+			}
304803
 			/* Take over the mount if there is one */
304803
 			valid->ioctlfd = me->ioctlfd;
304803
 			me->ioctlfd = -1;