64 lines
1.9 KiB
Diff
64 lines
1.9 KiB
Diff
|
autofs-5.1.8 - fix incorrect path for is_mounted() in try_remount()
|
||
|
|
||
|
From: Ian Kent <raven@themaw.net>
|
||
|
|
||
|
A regression was introduced when the offset mount handling was rewritten.
|
||
|
|
||
|
It resulted in an incorrect path sometimes being used in an is_mounted()
|
||
|
check.
|
||
|
|
||
|
Signed-off-by: Ian Kent <raven@themaw.net>
|
||
|
---
|
||
|
CHANGELOG | 1 +
|
||
|
lib/mounts.c | 26 +++++++++++++++++++++-----
|
||
|
2 files changed, 22 insertions(+), 5 deletions(-)
|
||
|
|
||
|
--- autofs-5.1.4.orig/CHANGELOG
|
||
|
+++ autofs-5.1.4/CHANGELOG
|
||
|
@@ -104,6 +104,7 @@
|
||
|
- fix memory leak in update_hosts_mounts().
|
||
|
- fix concat_options() error handling.
|
||
|
- fix minus only option handling in concat_options().
|
||
|
+- fix incorrect path for is_mounted() in try_remount().
|
||
|
|
||
|
xx/xx/2018 autofs-5.1.5
|
||
|
- fix flag file permission.
|
||
|
--- autofs-5.1.4.orig/lib/mounts.c
|
||
|
+++ autofs-5.1.4/lib/mounts.c
|
||
|
@@ -2803,14 +2803,30 @@ int try_remount(struct autofs_point *ap,
|
||
|
ap->flags &= ~MOUNT_FLAG_DIR_CREATED;
|
||
|
else
|
||
|
ap->flags |= MOUNT_FLAG_DIR_CREATED;
|
||
|
+ goto done;
|
||
|
+ }
|
||
|
+
|
||
|
+ me->flags &= ~MOUNT_FLAG_DIR_CREATED;
|
||
|
+ /* Direct or offset mount, key is full path */
|
||
|
+ if (MM_PARENT(me)->key[0] == '/') {
|
||
|
+ if (!is_mounted(MM_PARENT(me)->key, MNTS_REAL))
|
||
|
+ me->flags |= MOUNT_FLAG_DIR_CREATED;
|
||
|
} else {
|
||
|
- me->flags &= ~MOUNT_FLAG_DIR_CREATED;
|
||
|
- if (type == t_offset) {
|
||
|
- if (!is_mounted(MM_PARENT(me)->key, MNTS_REAL))
|
||
|
- me->flags |= MOUNT_FLAG_DIR_CREATED;
|
||
|
+ char *p_key = MM_PARENT(me)->key;
|
||
|
+ char mp[PATH_MAX + 1];
|
||
|
+ int len;
|
||
|
+
|
||
|
+ len = mount_fullpath(mp, PATH_MAX, ap->path, ap->len, p_key);
|
||
|
+ if (len > PATH_MAX) {
|
||
|
+ /* This should never happen due to earlier checks */
|
||
|
+ error(ap->logopt, "mountpoint path too long");
|
||
|
+ return 0;
|
||
|
}
|
||
|
- }
|
||
|
|
||
|
+ if (!is_mounted(mp, MNTS_REAL))
|
||
|
+ me->flags |= MOUNT_FLAG_DIR_CREATED;
|
||
|
+ }
|
||
|
+done:
|
||
|
/*
|
||
|
* Either we opened the mount or we're re-reading the map.
|
||
|
* If we opened the mount and ioctlfd is not -1 we have
|