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

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