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

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