fs: fix incorrect lflags value in the move_mount syscall
PATCH 1/1 fs: fix incorrect lflags value in the move_mount syscall
The lflags value used to look up from_path was overwritten by the one used to look up to_path.
In other words, from_path was looked up with the wrong lflags value. Fix it.
--- fs/namespace.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
fs/namespace.c +13 -9
@@ -4551,20 +4551,13 @@ SYSCALL_DEFINE5(move_mount,if (flags &MOVE_MOUNT_SET_GROUP ) mflags |=MNT_TREE_PROPAGATION ;if (flags &MOVE_MOUNT_BENEATH ) mflags |=MNT_TREE_BENEATH ; - lflags =0 ; -if (flags &MOVE_MOUNT_F_SYMLINKS ) lflags |=LOOKUP_FOLLOW ; -if (flags &MOVE_MOUNT_F_AUTOMOUNTS ) lflags |=LOOKUP_AUTOMOUNT ; - uflags =0 ; -if (flags &MOVE_MOUNT_F_EMPTY_PATH ) uflags =AT_EMPTY_PATH ; - from_name =getname_maybe_null (from_pathname, uflags); -if (IS_ERR (from_name)) -return PTR_ERR (from_name); - lflags =0 ;if (flags &MOVE_MOUNT_T_SYMLINKS ) lflags |=LOOKUP_FOLLOW ;if (flags &MOVE_MOUNT_T_AUTOMOUNTS ) lflags |=LOOKUP_AUTOMOUNT ; + uflags =0 ;if (flags &MOVE_MOUNT_T_EMPTY_PATH ) uflags =AT_EMPTY_PATH ; + to_name =getname_maybe_null (to_pathname, uflags);if (IS_ERR (to_name))return PTR_ERR (to_name);
@@ -4582,6 +4575,17 @@ SYSCALL_DEFINE5(move_mount,return ret; } + lflags =0 ; +if (flags &MOVE_MOUNT_F_SYMLINKS ) lflags |=LOOKUP_FOLLOW ; +if (flags &MOVE_MOUNT_F_AUTOMOUNTS ) lflags |=LOOKUP_AUTOMOUNT ; + + uflags =0 ; +if (flags &MOVE_MOUNT_F_EMPTY_PATH ) uflags =AT_EMPTY_PATH ; + + from_name =getname_maybe_null (from_pathname, uflags); +if (IS_ERR (from_name)) +return PTR_ERR (from_name); +if (!from_name && from_dfd >=0 ) {CLASS (fd_raw, f_from)(from_dfd);if (fd_empty (f_from))
Signature · 1 line
2.50.1
Quoted 6 lines · Yuntao Wang
The lflags value used to look up
from_pathwas overwritten by the one used to look upto_path.In other words,
from_pathwas looked up with the wrong lflags value. Fix it.
Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fixes
[1/1] fs: fix incorrect lflags value in the move_mount syscall
https://git.kernel.org/vfs/vfs/c/593d9e4c3d63
Quoted 17 lines · Christian Brauner
Quoted 6 lines · Yuntao Wang
The lflags value used to look up
from_pathwas overwritten by the one used to look upto_path.In other words,
from_pathwas looked up with the wrong lflags value. Fix it.Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Quoted 8 lines
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fixes[1/1] fs: fix incorrect lflags value in the
move_mountsyscallhttps://git.kernel.org/vfs/vfs/c/593d9e4c3d63
Hi Christian,
It seems the patch hasn't been applied to the vfs.fixes branch, the relevant code there appears unchanged.
Thanks,
Yuntao
Christian Brauner
maintainerQuoted 4 lines · Yuntao Wang
The lflags value used to look up
from_pathwas overwritten by the one used to look upto_path.In other words,
from_pathwas looked up with the wrong lflags value. Fix it.
Right, thanks.