cifs: fix file info setting in cifs_open_file()
authorPaulo Alcantara <pc@cjr.nz>
Fri, 6 Jan 2023 16:34:36 +0000 (13:34 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:14 +0000 (11:58 +0100)
commitd54a3ef8b8bdb9e12dc5ff97d44b9827416eed54
tree29ce19febb7ecebda730353bc80d3a1140b5f39e
parent5a574327d1c5f7036af84ebe99cddba88f7d2038
cifs: fix file info setting in cifs_open_file()

commit ba5d4c1596cada37793d405dd18d695cd3508902 upstream.

In cifs_open_file(), @buf must hold a pointer to a cifs_open_info_data
structure which is passed by cifs_nt_open(), so assigning @buf
directly to @fi was obviously wrong.

Fix this by passing a valid FILE_ALL_INFO structure to SMBLegacyOpen()
and CIFS_open(), and then copy the set structure to the corresponding
cifs_open_info_data::fi field with move_cifs_info_to_smb2() helper.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216889
Fixes: 76894f3e2f71 ("cifs: improve symlink handling for smb2+")
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb1ops.c