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