diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2017-01-26 14:27:27 +0100 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2017-01-27 11:16:02 +0100 |
commit | a0ebbc68329db047bc1b9b9e263ad3e8cf16be4b (patch) | |
tree | fbbc72518e97cbd0db164da6f84414a651194ab7 | |
parent | d912360dac45b66faadee99ead9c1d2630409bc7 (diff) | |
download | linux-stable-a0ebbc68329db047bc1b9b9e263ad3e8cf16be4b.tar.gz linux-stable-a0ebbc68329db047bc1b9b9e263ad3e8cf16be4b.tar.bz2 linux-stable-a0ebbc68329db047bc1b9b9e263ad3e8cf16be4b.zip |
Compare prepaths when comparing superblocks
commit c1d8b24d18192764fe82067ec6aa8d4c3bf094e0 upstream.
The patch
Fs/cifs: make share unaccessible at root level mountable
makes use of prepaths when any component of the underlying path is
inaccessible.
When mounting 2 separate shares having different prepaths but are other
wise similar in other respects, we end up sharing superblocks when we
shouldn't be doing so.
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Tested-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Acked-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r-- | fs/cifs/connect.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 98c9c867f1b3..7491e8445458 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2742,6 +2742,24 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) return 1; } +static int +match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data) +{ + struct cifs_sb_info *old = CIFS_SB(sb); + struct cifs_sb_info *new = mnt_data->cifs_sb; + + if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) { + if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)) + return 0; + /* The prepath should be null terminated strings */ + if (strcmp(new->prepath, old->prepath)) + return 0; + + return 1; + } + return 0; +} + int cifs_match_super(struct super_block *sb, void *data) { @@ -2769,7 +2787,8 @@ cifs_match_super(struct super_block *sb, void *data) if (!match_server(tcp_srv, volume_info) || !match_session(ses, volume_info) || - !match_tcon(tcon, volume_info->UNC)) { + !match_tcon(tcon, volume_info->UNC) || + !match_prepath(sb, mnt_data)) { rc = 0; goto out; } |