diff options
| author | Sachin Prabhu <sprabhu@redhat.com> | 2017-04-26 09:05:46 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-20 08:28:39 -0400 |
| commit | 4f5e1c48e80b5be66a5078369f9dddf6e178b37e (patch) | |
| tree | 6ce73dabb3c05446947f9e9bb9ac3861f691a5a4 /fs/cifs | |
| parent | 4e434d4fe28a40d437573f25c9326b230217f017 (diff) | |
Fix match_prepath()
commit cd8c42968ee651b69e00f8661caff32b0086e82d upstream.
Incorrect return value for shares not using the prefix path means that
we will never match superblocks for these shares.
Fixes: commit c1d8b24d1819 ("Compare prepaths when comparing superblocks")
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/cifs')
| -rw-r--r-- | fs/cifs/connect.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b8015de88e8c..1a545695f547 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -2839,16 +2839,14 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data) | |||
| 2839 | { | 2839 | { |
| 2840 | struct cifs_sb_info *old = CIFS_SB(sb); | 2840 | struct cifs_sb_info *old = CIFS_SB(sb); |
| 2841 | struct cifs_sb_info *new = mnt_data->cifs_sb; | 2841 | struct cifs_sb_info *new = mnt_data->cifs_sb; |
| 2842 | bool old_set = old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH; | ||
| 2843 | bool new_set = new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH; | ||
| 2842 | 2844 | ||
| 2843 | if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) { | 2845 | if (old_set && new_set && !strcmp(new->prepath, old->prepath)) |
| 2844 | if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)) | ||
| 2845 | return 0; | ||
| 2846 | /* The prepath should be null terminated strings */ | ||
| 2847 | if (strcmp(new->prepath, old->prepath)) | ||
| 2848 | return 0; | ||
| 2849 | |||
| 2850 | return 1; | 2846 | return 1; |
| 2851 | } | 2847 | else if (!old_set && !new_set) |
| 2848 | return 1; | ||
| 2849 | |||
| 2852 | return 0; | 2850 | return 0; |
| 2853 | } | 2851 | } |
| 2854 | 2852 | ||
