Skip to content

Commit 9241433

Browse files
Paulo Alcantarasmfrench
authored andcommitted
smb: client: fix potential NULL deref in parse_dfs_referrals()
If server returned no data for FSCTL_DFS_GET_REFERRALS, @dfs_rsp will remain NULL and then parse_dfs_referrals() will dereference it. Fix this by returning -EIO when no output data is returned. Besides, we can't fix it in SMB2_ioctl() as some FSCTLs are allowed to return no data as per MS-SMB2 2.2.32. Fixes: 9d49640 ("CIFS: implement get_dfs_refer for SMB2+") Cc: [email protected] Reported-by: Robert Morris <[email protected]> Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent c54fc3a commit 9241433

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/smb/client/smb2ops.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,6 +2836,8 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
28362836
usleep_range(512, 2048);
28372837
} while (++retry_count < 5);
28382838

2839+
if (!rc && !dfs_rsp)
2840+
rc = -EIO;
28392841
if (rc) {
28402842
if (!is_retryable_error(rc) && rc != -ENOENT && rc != -EOPNOTSUPP)
28412843
cifs_tcon_dbg(VFS, "%s: ioctl error: rc=%d\n", __func__, rc);

0 commit comments

Comments
 (0)