smb: client: fix potential NULL deref in parse_dfs_referrals()
authorPaulo Alcantara <pc@manguebit.com>
Wed, 6 Dec 2023 00:49:29 +0000 (21:49 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Dec 2023 17:45:32 +0000 (18:45 +0100)
commit5ac34ba42e9aba7fc82997f778802b954efced33
tree3d5d14c9942d4f0b424734bf1097c017a3052b34
parent05668be6020c277fd027baa2282ba559ea73a695
smb: client: fix potential NULL deref in parse_dfs_referrals()

commit 92414333eb375ed64f4ae92d34d579e826936480 upstream.

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: 9d49640a21bf ("CIFS: implement get_dfs_refer for SMB2+")
Cc: stable@vger.kernel.org
Reported-by: Robert Morris <rtm@csail.mit.edu>
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/client/smb2ops.c