Skip to content

Commit e6c47dd

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: check if SMB2 PDU size has been padded and suppress the warning
Some SMB2/3 servers, Win2016 but possibly others too, adds padding not only between PDUs in a compound but also to the final PDU. This padding extends the PDU to a multiple of 8 bytes. Check if the unexpected length looks like this might be the case and avoid triggering the log messages for : "SMB2 server sent bad RFC1001 len %d not %d\n" Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 4d8dfaf commit e6c47dd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/cifs/smb2misc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,13 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr)
237237
if (clc_len == len + 1)
238238
return 0;
239239

240+
/*
241+
* Some windows servers (win2016) will pad also the final
242+
* PDU in a compound to 8 bytes.
243+
*/
244+
if (((clc_len + 7) & ~7) == len)
245+
return 0;
246+
240247
/*
241248
* MacOS server pads after SMB2.1 write response with 3 bytes
242249
* of junk. Other servers match RFC1001 len to actual

0 commit comments

Comments
 (0)