]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.34/cifs-accept-validate-negotiate-if-server-return-nt_s.patch
Linux 4.19.34
[thirdparty/kernel/stable-queue.git] / releases / 4.19.34 / cifs-accept-validate-negotiate-if-server-return-nt_s.patch
CommitLineData
ba172962
SL
1From 4782fdff5c29efe271b4a5194c4b90def1ca1332 Mon Sep 17 00:00:00 2001
2From: Namjae Jeon <linkinjeon@gmail.com>
3Date: Tue, 22 Jan 2019 09:46:45 +0900
4Subject: cifs: Accept validate negotiate if server return
5 NT_STATUS_NOT_SUPPORTED
6
7[ Upstream commit 969ae8e8d4ee54c99134d3895f2adf96047f5bee ]
8
9Old windows version or Netapp SMB server will return
10NT_STATUS_NOT_SUPPORTED since they do not allow or implement
11FSCTL_VALIDATE_NEGOTIATE_INFO. The client should accept the response
12provided it's properly signed.
13
14See
15https://blogs.msdn.microsoft.com/openspecification/2012/06/28/smb3-secure-dialect-negotiation/
16
17and
18
19MS-SMB2 validate negotiate response processing:
20https://msdn.microsoft.com/en-us/library/hh880630.aspx
21
22Samba client had already handled it.
23https://bugzilla.samba.org/attachment.cgi?id=13285&action=edit
24
25Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
26Signed-off-by: Steve French <stfrench@microsoft.com>
27Signed-off-by: Sasha Levin <sashal@kernel.org>
28---
29 fs/cifs/smb2pdu.c | 10 ++++++++--
30 1 file changed, 8 insertions(+), 2 deletions(-)
31
32diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
33index 3d0db37d64ad..71f32d983384 100644
34--- a/fs/cifs/smb2pdu.c
35+++ b/fs/cifs/smb2pdu.c
36@@ -881,8 +881,14 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
37 rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
38 FSCTL_VALIDATE_NEGOTIATE_INFO, true /* is_fsctl */,
39 (char *)pneg_inbuf, inbuflen, (char **)&pneg_rsp, &rsplen);
40-
41- if (rc != 0) {
42+ if (rc == -EOPNOTSUPP) {
43+ /*
44+ * Old Windows versions or Netapp SMB server can return
45+ * not supported error. Client should accept it.
46+ */
47+ cifs_dbg(VFS, "Server does not support validate negotiate\n");
48+ return 0;
49+ } else if (rc != 0) {
50 cifs_dbg(VFS, "validate protocol negotiate failed: %d\n", rc);
51 rc = -EIO;
52 goto out_free_inbuf;
53--
542.19.1
55