Skip to content

Commit fe12926

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: fix NULL dereference in match_prepath
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 <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 643fbce commit fe12926

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/cifs/connect.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3709,8 +3709,10 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data)
37093709
{
37103710
struct cifs_sb_info *old = CIFS_SB(sb);
37113711
struct cifs_sb_info *new = mnt_data->cifs_sb;
3712-
bool old_set = old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
3713-
bool new_set = new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
3712+
bool old_set = (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) &&
3713+
old->prepath;
3714+
bool new_set = (new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) &&
3715+
new->prepath;
37143716

37153717
if (old_set && new_set && !strcmp(new->prepath, old->prepath))
37163718
return 1;

0 commit comments

Comments
 (0)