aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-25 16:17:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-25 16:17:53 -0400
commit04faac10fcd2d0f7af8183fa02dea26919e29571 (patch)
treed5c0877e3f1d1922556effb78c30a14c9d823370
parent1b2de5d039c883c9d44ae5b2b6eca4ff9bd82dac (diff)
parent7753e38286d2bd7380df8be843de83198e2ce492 (diff)
Merge tag '4.19-rc-smb3' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "Three small SMB3 fixes, one for stable" * tag '4.19-rc-smb3' of git://git.samba.org/sfrench/cifs-2.6: cifs: update internal module version number for cifs.ko to 2.12 cifs: check kmalloc before use cifs: check if SMB2 PDU size has been padded and suppress the warning cifs: create a define for how many iovs we need for an SMB2_open()
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/sess.c6
-rw-r--r--fs/cifs/smb2misc.c7
-rw-r--r--fs/cifs/smb2ops.c4
-rw-r--r--fs/cifs/smb2pdu.c4
-rw-r--r--fs/cifs/smb2pdu.h12
6 files changed, 30 insertions, 5 deletions
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index f3a78efc3109..f047e87871a1 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -148,5 +148,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
148extern const struct export_operations cifs_export_ops; 148extern const struct export_operations cifs_export_ops;
149#endif /* CONFIG_CIFS_NFSD_EXPORT */ 149#endif /* CONFIG_CIFS_NFSD_EXPORT */
150 150
151#define CIFS_VERSION "2.12" 151#define CIFS_VERSION "2.13"
152#endif /* _CIFSFS_H */ 152#endif /* _CIFSFS_H */
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 8b0502cd39af..aa23c00367ec 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -398,6 +398,12 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,
398 goto setup_ntlmv2_ret; 398 goto setup_ntlmv2_ret;
399 } 399 }
400 *pbuffer = kmalloc(size_of_ntlmssp_blob(ses), GFP_KERNEL); 400 *pbuffer = kmalloc(size_of_ntlmssp_blob(ses), GFP_KERNEL);
401 if (!*pbuffer) {
402 rc = -ENOMEM;
403 cifs_dbg(VFS, "Error %d during NTLMSSP allocation\n", rc);
404 *buflen = 0;
405 goto setup_ntlmv2_ret;
406 }
401 sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer; 407 sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer;
402 408
403 memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8); 409 memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 303d4592ebe7..db0453660ff6 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -238,6 +238,13 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr)
238 return 0; 238 return 0;
239 239
240 /* 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
247 /*
241 * MacOS server pads after SMB2.1 write response with 3 bytes 248 * MacOS server pads after SMB2.1 write response with 3 bytes
242 * of junk. Other servers match RFC1001 len to actual 249 * of junk. Other servers match RFC1001 len to actual
243 * SMB2/SMB3 frame length (header + smb2 response specific data) 250 * SMB2/SMB3 frame length (header + smb2 response specific data)
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 541258447c4c..247a98e6c856 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1582,7 +1582,7 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
1582 struct smb_rqst rqst[3]; 1582 struct smb_rqst rqst[3];
1583 int resp_buftype[3]; 1583 int resp_buftype[3];
1584 struct kvec rsp_iov[3]; 1584 struct kvec rsp_iov[3];
1585 struct kvec open_iov[5]; /* 4 + potential padding. */ 1585 struct kvec open_iov[SMB2_CREATE_IOV_SIZE];
1586 struct kvec qi_iov[1]; 1586 struct kvec qi_iov[1];
1587 struct kvec close_iov[1]; 1587 struct kvec close_iov[1];
1588 struct cifs_ses *ses = tcon->ses; 1588 struct cifs_ses *ses = tcon->ses;
@@ -1603,7 +1603,7 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
1603 1603
1604 memset(&open_iov, 0, sizeof(open_iov)); 1604 memset(&open_iov, 0, sizeof(open_iov));
1605 rqst[0].rq_iov = open_iov; 1605 rqst[0].rq_iov = open_iov;
1606 rqst[0].rq_nvec = 4; 1606 rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
1607 1607
1608 oparms.tcon = tcon; 1608 oparms.tcon = tcon;
1609 oparms.desired_access = FILE_READ_ATTRIBUTES; 1609 oparms.desired_access = FILE_READ_ATTRIBUTES;
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 2f1938011395..5740aa809be6 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2256,7 +2256,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
2256 struct TCP_Server_Info *server; 2256 struct TCP_Server_Info *server;
2257 struct cifs_tcon *tcon = oparms->tcon; 2257 struct cifs_tcon *tcon = oparms->tcon;
2258 struct cifs_ses *ses = tcon->ses; 2258 struct cifs_ses *ses = tcon->ses;
2259 struct kvec iov[5]; /* make sure at least one for each open context */ 2259 struct kvec iov[SMB2_CREATE_IOV_SIZE];
2260 struct kvec rsp_iov = {NULL, 0}; 2260 struct kvec rsp_iov = {NULL, 0};
2261 int resp_buftype; 2261 int resp_buftype;
2262 int rc = 0; 2262 int rc = 0;
@@ -2274,7 +2274,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
2274 memset(&rqst, 0, sizeof(struct smb_rqst)); 2274 memset(&rqst, 0, sizeof(struct smb_rqst));
2275 memset(&iov, 0, sizeof(iov)); 2275 memset(&iov, 0, sizeof(iov));
2276 rqst.rq_iov = iov; 2276 rqst.rq_iov = iov;
2277 rqst.rq_nvec = 5; 2277 rqst.rq_nvec = SMB2_CREATE_IOV_SIZE;
2278 2278
2279 rc = SMB2_open_init(tcon, &rqst, oplock, oparms, path); 2279 rc = SMB2_open_init(tcon, &rqst, oplock, oparms, path);
2280 if (rc) 2280 if (rc)
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index a2eeae9e0432..8fb7887f2b3d 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -614,6 +614,18 @@ struct smb2_tree_disconnect_rsp {
614#define SMB2_CREATE_TAG_POSIX 0x93AD25509CB411E7B42383DE968BCD7C 614#define SMB2_CREATE_TAG_POSIX 0x93AD25509CB411E7B42383DE968BCD7C
615 615
616 616
617/*
618 * Maximum number of iovs we need for an open/create request.
619 * [0] : struct smb2_create_req
620 * [1] : path
621 * [2] : lease context
622 * [3] : durable context
623 * [4] : posix context
624 * [5] : time warp context
625 * [6] : compound padding
626 */
627#define SMB2_CREATE_IOV_SIZE 7
628
617struct smb2_create_req { 629struct smb2_create_req {
618 struct smb2_sync_hdr sync_hdr; 630 struct smb2_sync_hdr sync_hdr;
619 __le16 StructureSize; /* Must be 57 */ 631 __le16 StructureSize; /* Must be 57 */