]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cifs: avoid dup prefix path in dfs_get_automount_devname()
authorPaulo Alcantara <pc@manguebit.com>
Sun, 16 Apr 2023 18:38:28 +0000 (15:38 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Apr 2023 12:30:07 +0000 (14:30 +0200)
commite91802036b3e6e6e803a17ddf5783a6354fe5380
tree63328326ce3149ba93e588dec22415e930c11d93
parent0d30989fe9a176565d360376d4bc2ea1c61cbbac
cifs: avoid dup prefix path in dfs_get_automount_devname()

commit d5a863a153e90996ab2aef6b9e08d509f4d5662b upstream.

@server->origin_fullpath already contains the tree name + optional
prefix, so avoid calling __build_path_from_dentry_optional_prefix() as
it might end up duplicating prefix path from @cifs_sb->prepath into
final full path.

Instead, generate DFS full path by simply merging
@server->origin_fullpath with dentry's path.

This fixes the following case

mount.cifs //root/dfs/dir /mnt/ -o ...
ls /mnt/link

where cifs_dfs_do_automount() will call smb3_parse_devname() with
@devname set to "//root/dfs/dir/link" instead of
"//root/dfs/dir/dir/link".

Fixes: 7ad54b98fc1f ("cifs: use origin fullpath for automounts")
Cc: <stable@vger.kernel.org> # 6.2+
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/cifs_dfs_ref.c
fs/cifs/dfs.h