summaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2018-08-22 12:19:24 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-15 09:46:45 +0200
commit8043c90bada1f89271325c0ff765d5a40c7a6f5e (patch)
treef92f6a2cfe963e8b8fe7a612081b568d71a9c24a /fs/cifs
parentded39314abc0ffb4c0d9ed0c6c6a82f0e4f4d2d8 (diff)
downloadlinux-stable-8043c90bada1f89271325c0ff765d5a40c7a6f5e.tar.gz
linux-stable-8043c90bada1f89271325c0ff765d5a40c7a6f5e.tar.bz2
linux-stable-8043c90bada1f89271325c0ff765d5a40c7a6f5e.zip
cifs: check if SMB2 PDU size has been padded and suppress the warning
[ Upstream commit e6c47dd0da1e3a484e778046fc10da0b20606a86 ] 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 <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/smb2misc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 3ff7cec2da81..239215dcc00b 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -241,6 +241,13 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr)
return 0;
/*
+ * Some windows servers (win2016) will pad also the final
+ * PDU in a compound to 8 bytes.
+ */
+ if (((clc_len + 7) & ~7) == len)
+ return 0;
+
+ /*
* MacOS server pads after SMB2.1 write response with 3 bytes
* of junk. Other servers match RFC1001 len to actual
* SMB2/SMB3 frame length (header + smb2 response specific data)