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

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