diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2020-01-22 11:07:56 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-02-28 15:42:39 +0100 |
commit | 5b327446f6cd35f4738ce41ef9f15ef95c404273 (patch) | |
tree | ed2d4b7c5dfd69bf67280516e73e43a89525dbcc /fs | |
parent | 88213ab3d0c9ba59233a6c8afa07ca5e662cebfa (diff) | |
download | linux-stable-5b327446f6cd35f4738ce41ef9f15ef95c404273.tar.gz linux-stable-5b327446f6cd35f4738ce41ef9f15ef95c404273.tar.bz2 linux-stable-5b327446f6cd35f4738ce41ef9f15ef95c404273.zip |
cifs: fix NULL dereference in match_prepath
[ Upstream commit fe1292686333d1dadaf84091f585ee903b9ddb84 ]
RHBZ: 1760879
Fix an oops in match_prepath() by making sure that the prepath string is not
NULL before we pass it into strcmp().
This is similar to other checks we make for example in cifs_root_iget()
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/connect.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 751bdde6515d..961fcb40183a 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2927,8 +2927,10 @@ 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; - bool old_set = old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH; - bool new_set = new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH; + bool old_set = (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) && + old->prepath; + bool new_set = (new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) && + new->prepath; if (old_set && new_set && !strcmp(new->prepath, old->prepath)) return 1; |