autofs-5.1.9 - fix setting submount autofs_point in mnts_add_submount() From: Ian Kent It's possible the autofs_point field set in the mnt_list structure points to the parent. Make sure it's set and that it points to the required value and remove the now redundant error check. Signed-off-by: Ian Kent --- CHANGELOG | 1 + lib/mounts.c | 14 +++----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c508285c2..4c05a33d7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -109,6 +109,7 @@ - fix map source deadlock for recursive submounts. - fix master_notify_submount() return. - fix thinko in __mnt_find_submount_by_devid(). +- fix setting submount autofs_point in mnts_add_submount(). 02/11/2023 autofs-5.1.9 - fix kernel mount status notification. diff --git a/lib/mounts.c b/lib/mounts.c index 6874f185d..3db674a34 100644 --- a/lib/mounts.c +++ b/lib/mounts.c @@ -1149,27 +1149,19 @@ struct autofs_point *mnt_find_submount_by_devid(struct list_head *submounts, dev struct mnt_list *mnts_add_submount(struct autofs_point *ap) { - struct mnt_list *this; + struct mnt_list *this = NULL; mnts_hash_mutex_lock(); this = mnts_get_mount(ap->path); if (this) { - if (!this->ap) + if (!this->ap || this->ap != ap) this->ap = ap; - else if (this->ap != ap || - this->ap->parent != ap->parent) { - __mnts_put_mount(this); - mnts_hash_mutex_unlock(); - error(ap->logopt, - "conflict with submount owner: %s", ap->path); - goto fail; - } this->flags |= MNTS_AUTOFS; if (list_empty(&this->submount)) list_add_tail(&this->submount, &ap->parent->submounts); } mnts_hash_mutex_unlock(); -fail: + return this; }