Skip to content

Commit a3e771a

Browse files
paliSteve French
authored andcommitted
cifs: Fix cifs_query_path_info() for Windows NT servers
For TRANS2 QUERY_PATH_INFO request when the path does not exist, the Windows NT SMB server returns error response STATUS_OBJECT_NAME_NOT_FOUND or ERRDOS/ERRbadfile without the SMBFLG_RESPONSE flag set. Similarly it returns STATUS_DELETE_PENDING when the file is being deleted. And looks like that any error response from TRANS2 QUERY_PATH_INFO does not have SMBFLG_RESPONSE flag set. So relax check in check_smb_hdr() for detecting if the packet is response for this special case. This change fixes stat() operation against Windows NT SMB servers and also all operations which depends on -ENOENT result from stat like creat() or mkdir(). Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 56e84c6 commit a3e771a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/smb/client/misc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,14 @@ check_smb_hdr(struct smb_hdr *smb)
326326
if (smb->Command == SMB_COM_LOCKING_ANDX)
327327
return 0;
328328

329+
/*
330+
* Windows NT server returns error resposne (e.g. STATUS_DELETE_PENDING
331+
* or STATUS_OBJECT_NAME_NOT_FOUND or ERRDOS/ERRbadfile or any other)
332+
* for some TRANS2 requests without the RESPONSE flag set in header.
333+
*/
334+
if (smb->Command == SMB_COM_TRANSACTION2 && smb->Status.CifsError != 0)
335+
return 0;
336+
329337
cifs_dbg(VFS, "Server sent request, not response. mid=%u\n",
330338
get_mid(smb));
331339
return 1;

0 commit comments

Comments
 (0)