fs/cifs: make share unaccessible at root level mountable
if, when mounting //HOST/share/sub/dir/foo we can query /sub/dir/foo but not any of the path components above: - store the /sub/dir/foo prefix in the cifs super_block info - in the superblock, set root dentry to the subpath dentry (instead of the share root) - set a flag in the superblock to remember it - use prefixpath when building path from a dentry fixes bso#8950 Signed-off-by: Aurelien Aptel <aaptel@suse.com> CC: Stable <stable@vger.kernel.org> Reviewed-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:

committed by
Steve French

parent
bd975d1eea
commit
a6b5058faf
@@ -689,6 +689,14 @@ cifs_do_mount(struct file_system_type *fs_type,
|
||||
goto out_cifs_sb;
|
||||
}
|
||||
|
||||
if (volume_info->prepath) {
|
||||
cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL);
|
||||
if (cifs_sb->prepath == NULL) {
|
||||
root = ERR_PTR(-ENOMEM);
|
||||
goto out_cifs_sb;
|
||||
}
|
||||
}
|
||||
|
||||
cifs_setup_cifs_sb(volume_info, cifs_sb);
|
||||
|
||||
rc = cifs_mount(cifs_sb, volume_info);
|
||||
@@ -727,7 +735,11 @@ cifs_do_mount(struct file_system_type *fs_type,
|
||||
sb->s_flags |= MS_ACTIVE;
|
||||
}
|
||||
|
||||
root = cifs_get_root(volume_info, sb);
|
||||
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)
|
||||
root = dget(sb->s_root);
|
||||
else
|
||||
root = cifs_get_root(volume_info, sb);
|
||||
|
||||
if (IS_ERR(root))
|
||||
goto out_super;
|
||||
|
||||
|
Reference in New Issue
Block a user