History

Merge tag '5.4-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull more cifs updates from Steve French: "Fixes from the recent SMB3 Test events and Storage Developer Conference (held the last two weeks). Here are nine smb3 patches including an important patch for debugging traces with wireshark, with three patches marked for stable. Additional fixes from last week to better handle some newly discovered reparse points, and a fix the create/mkdir path for setting the mode more atomically (in SMB3 Create security descriptor context), and one for path name processing are still being tested so are not included here" * tag '5.4-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: CIFS: Fix oplock handling for SMB 2.1+ protocols smb3: missing ACL related flags smb3: pass mode bits into create calls smb3: Add missing reparse tags CIFS: fix max ea value size fs/cifs/sess.c: Remove set but not used variable 'capabilities' fs/cifs/smb2pdu.c: Make SMB2_notify_init static smb3: fix leak in "open on server" perf counter smb3: allow decryption keys to be dumped by admin for debugging

Linus Torvalds committed 7 years ago

Commit 7edee522 parents 3f2dc27 a016e2714 files · +194 −26Browse files

Unified · Split

14 files
  1. fs/cifs/cifs_ioctl.h +9 −0
  2. fs/cifs/cifsacl.h +80 −1
  3. fs/cifs/cifsglob.h +4 −2
  4. fs/cifs/cifsproto.h +2 −1
  5. fs/cifs/cifssmb.c +2 −1
  6. fs/cifs/inode.c +2 −1
  7. fs/cifs/ioctl.c +29 −0
  8. fs/cifs/sess.c +1 −2
  9. fs/cifs/smb2inode.c +19 −15
  10. fs/cifs/smb2ops.c +10 −0
  11. fs/cifs/smb2pdu.c +22 −1
  12. fs/cifs/smb2proto.h +2 −1
  13. fs/cifs/smbfsctl.h +11 −0
  14. fs/cifs/xattr.c +1 −1
fs/cifs/cifs_ioctl.h+9−0
@@ -57,9 +57,18 @@ struct smb_query_info { · 56 unmodified lines
57 /* char buffer[]; */57 /* char buffer[]; */
58} __packed;58} __packed;
59 59
60struct smb3_key_debug_info {
61 __u64 Suid;
62 __u16 cipher_type;
63 __u8 auth_key[16]; /* SMB2_NTLMV2_SESSKEY_SIZE */
64 __u8 smb3encryptionkey[SMB3_SIGN_KEY_SIZE];
65 __u8 smb3decryptionkey[SMB3_SIGN_KEY_SIZE];
66} __packed;
67
60#define CIFS_IOCTL_MAGIC 0xCF68#define CIFS_IOCTL_MAGIC 0xCF
61#define CIFS_IOC_COPYCHUNK_FILE _IOW(CIFS_IOCTL_MAGIC, 3, int)69#define CIFS_IOC_COPYCHUNK_FILE _IOW(CIFS_IOCTL_MAGIC, 3, int)
62#define CIFS_IOC_SET_INTEGRITY _IO(CIFS_IOCTL_MAGIC, 4)70#define CIFS_IOC_SET_INTEGRITY _IO(CIFS_IOCTL_MAGIC, 4)
63#define CIFS_IOC_GET_MNT_INFO _IOR(CIFS_IOCTL_MAGIC, 5, struct smb_mnt_fs_info)71#define CIFS_IOC_GET_MNT_INFO _IOR(CIFS_IOCTL_MAGIC, 5, struct smb_mnt_fs_info)
64#define CIFS_ENUMERATE_SNAPSHOTS _IOR(CIFS_IOCTL_MAGIC, 6, struct smb_snapshot_array)72#define CIFS_ENUMERATE_SNAPSHOTS _IOR(CIFS_IOCTL_MAGIC, 6, struct smb_snapshot_array)
65#define CIFS_QUERY_INFO _IOWR(CIFS_IOCTL_MAGIC, 7, struct smb_query_info)73#define CIFS_QUERY_INFO _IOWR(CIFS_IOCTL_MAGIC, 7, struct smb_query_info)
74#define CIFS_DUMP_KEY _IOWR(CIFS_IOCTL_MAGIC, 8, struct smb3_key_debug_info)
fs/cifs/cifsacl.h+80−1
@@ -90,14 +90,93 @@ struct cifs_acl { · 89 unmodified lines
90 __le32 num_aces;90 __le32 num_aces;
91} __attribute__((packed));91} __attribute__((packed));
92 92
93/* ACE types - see MS-DTYP 2.4.4.1 */
94#define ACCESS_ALLOWED_ACE_TYPE 0x00
95#define ACCESS_DENIED_ACE_TYPE 0x01
96#define SYSTEM_AUDIT_ACE_TYPE 0x02
97#define SYSTEM_ALARM_ACE_TYPE 0x03
98#define ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04
99#define ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05
100#define ACCESS_DENIED_OBJECT_ACE_TYPE 0x06
101#define SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07
102#define SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08
103#define ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09
104#define ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A
105#define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B
106#define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C
107#define SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D
108#define SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E /* Reserved */
109#define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F
110#define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10 /* reserved */
111#define SYSTEM_MANDATORY_LABEL_ACE_TYPE 0x11
112#define SYSTEM_RESOURCE_ATTRIBUTE_ACE_TYPE 0x12
113#define SYSTEM_SCOPED_POLICY_ID_ACE_TYPE 0x13
114
115/* ACE flags */
116#define OBJECT_INHERIT_ACE 0x01
117#define CONTAINER_INHERIT_ACE 0x02
118#define NO_PROPAGATE_INHERIT_ACE 0x04
119#define INHERIT_ONLY_ACE 0x08
120#define INHERITED_ACE 0x10
121#define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
122#define FAILED_ACCESS_ACE_FLAG 0x80
123
93struct cifs_ace {124struct cifs_ace {
94 __u8 type;125 __u8 type; /* see above and MS-DTYP 2.4.4.1 */
95 __u8 flags;126 __u8 flags;
96 __le16 size;127 __le16 size;
97 __le32 access_req;128 __le32 access_req;
98 struct cifs_sid sid; /* ie UUID of user or group who gets these perms */129 struct cifs_sid sid; /* ie UUID of user or group who gets these perms */
99} __attribute__((packed));130} __attribute__((packed));
100 131
132/*
133 * The current SMB3 form of security descriptor is similar to what was used for
134 * cifs (see above) but some fields are split, and fields in the struct below
135 * matches names of fields to the the spec, MS-DTYP (see sections 2.4.5 and
136 * 2.4.6). Note that "CamelCase" fields are used in this struct in order to
137 * match the MS-DTYP and MS-SMB2 specs which define the wire format.
138 */
139struct smb3_sd {
140 __u8 Revision; /* revision level, MUST be one */
141 __u8 Sbz1; /* only meaningful if 'RM' flag set below */
142 __le16 Control;
143 __le32 OffsetOwner;
144 __le32 OffsetGroup;
145 __le32 OffsetSacl;
146 __le32 OffsetDacl;
147} __packed;
148
149/* Meaning of 'Control' field flags */
150#define ACL_CONTROL_SR 0x0001 /* Self relative */
151#define ACL_CONTROL_RM 0x0002 /* Resource manager control bits */
152#define ACL_CONTROL_PS 0x0004 /* SACL protected from inherits */
153#define ACL_CONTROL_PD 0x0008 /* DACL protected from inherits */
154#define ACL_CONTROL_SI 0x0010 /* SACL Auto-Inherited */
155#define ACL_CONTROL_DI 0x0020 /* DACL Auto-Inherited */
156#define ACL_CONTROL_SC 0x0040 /* SACL computed through inheritance */
157#define ACL_CONTROL_DC 0x0080 /* DACL computed through inheritence */
158#define ACL_CONTROL_SS 0x0100 /* Create server ACL */
159#define ACL_CONTROL_DT 0x0200 /* DACL provided by trusteed source */
160#define ACL_CONTROL_SD 0x0400 /* SACL defaulted */
161#define ACL_CONTROL_SP 0x0800 /* SACL is present on object */
162#define ACL_CONTROL_DD 0x1000 /* DACL defaulted */
163#define ACL_CONTROL_DP 0x2000 /* DACL is present on object */
164#define ACL_CONTROL_GD 0x4000 /* Group was defaulted */
165#define ACL_CONTROL_OD 0x8000 /* User was defaulted */
166
167/* Meaning of AclRevision flags */
168#define ACL_REVISION 0x02 /* See section 2.4.4.1 of MS-DTYP */
169#define ACL_REVISION_DS 0x04 /* Additional AceTypes allowed */
170
171struct smb3_acl {
172 u8 AclRevision; /* revision level */
173 u8 Sbz1; /* MBZ */
174 __le16 AclSize;
175 __le16 AceCount;
176 __le16 Sbz2; /* MBZ */
177} __packed;
178
179
101/*180/*
102 * Minimum security identifier can be one for system defined Users181 * Minimum security identifier can be one for system defined Users
103 * and Groups such as NULL SID and World or Built-in accounts such182 * and Groups such as NULL SID and World or Built-in accounts such
fs/cifs/cifsglob.h+4−2
@@ -331,8 +331,9 @@ struct smb_version_operations { · 330 unmodified lines
331 umode_t mode, struct cifs_tcon *tcon,331 umode_t mode, struct cifs_tcon *tcon,
332 const char *full_path,332 const char *full_path,
333 struct cifs_sb_info *cifs_sb);333 struct cifs_sb_info *cifs_sb);
334 int (*mkdir)(const unsigned int, struct cifs_tcon *, const char *,334 int (*mkdir)(const unsigned int xid, struct inode *inode, umode_t mode,
335 struct cifs_sb_info *);335 struct cifs_tcon *tcon, const char *name,
336 struct cifs_sb_info *sb);
336 /* set info on created directory */337 /* set info on created directory */
337 void (*mkdir_setinfo)(struct inode *, const char *,338 void (*mkdir_setinfo)(struct inode *, const char *,
338 struct cifs_sb_info *, struct cifs_tcon *,339 struct cifs_sb_info *, struct cifs_tcon *,
@@ -1209,6 +1210,7 @@ struct cifs_search_info { · 870 unmodified lines
1209 bool smallBuf:1; /* so we know which buf_release function to call */1210 bool smallBuf:1; /* so we know which buf_release function to call */
1210};1211};
1211 1212
1213#define ACL_NO_MODE -1
1212struct cifs_open_parms {1214struct cifs_open_parms {
1213 struct cifs_tcon *tcon;1215 struct cifs_tcon *tcon;
1214 struct cifs_sb_info *cifs_sb;1216 struct cifs_sb_info *cifs_sb;
fs/cifs/cifsproto.h+2−1
@@ -372,7 +372,8 @@ extern int CIFSSMBUnixSetPathInfo(const unsigned int xid, · 371 unmodified lines
372 const struct nls_table *nls_codepage,372 const struct nls_table *nls_codepage,
373 int remap);373 int remap);
374 374
375extern int CIFSSMBMkDir(const unsigned int xid, struct cifs_tcon *tcon,375extern int CIFSSMBMkDir(const unsigned int xid, struct inode *inode,
376 umode_t mode, struct cifs_tcon *tcon,
376 const char *name, struct cifs_sb_info *cifs_sb);377 const char *name, struct cifs_sb_info *cifs_sb);
377extern int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon,378extern int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon,
378 const char *name, struct cifs_sb_info *cifs_sb);379 const char *name, struct cifs_sb_info *cifs_sb);
fs/cifs/cifssmb.c+2−1
@@ -1078,7 +1078,8 @@ RmDirRetry: · 1077 unmodified lines
1078}1078}
1079 1079
1080int1080int
1081CIFSSMBMkDir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,1081CIFSSMBMkDir(const unsigned int xid, struct inode *inode, umode_t mode,
1082 struct cifs_tcon *tcon, const char *name,
1082 struct cifs_sb_info *cifs_sb)1083 struct cifs_sb_info *cifs_sb)
1083{1084{
1084 int rc = 0;1085 int rc = 0;
fs/cifs/inode.c+2−1
@@ -1622,13 +1622,14 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode) · 1621 unmodified lines
1622 }1622 }
1623 1623
1624 /* BB add setting the equivalent of mode via CreateX w/ACLs */1624 /* BB add setting the equivalent of mode via CreateX w/ACLs */
1625 rc = server->ops->mkdir(xid, tcon, full_path, cifs_sb);1625 rc = server->ops->mkdir(xid, inode, mode, tcon, full_path, cifs_sb);
1626 if (rc) {1626 if (rc) {
1627 cifs_dbg(FYI, "cifs_mkdir returned 0x%x\n", rc);1627 cifs_dbg(FYI, "cifs_mkdir returned 0x%x\n", rc);
1628 d_drop(direntry);1628 d_drop(direntry);
1629 goto mkdir_out;1629 goto mkdir_out;
1630 }1630 }
1631 1631
1632 /* TODO: skip this for smb2/smb3 */
1632 rc = cifs_mkdir_qinfo(inode, direntry, mode, full_path, cifs_sb, tcon,1633 rc = cifs_mkdir_qinfo(inode, direntry, mode, full_path, cifs_sb, tcon,
1633 xid);1634 xid);
1634mkdir_out:1635mkdir_out:
fs/cifs/ioctl.c+29−0
@@ -164,6 +164,7 @@ static long smb_mnt_get_fsinfo(unsigned int xid, struct cifs_tcon *tcon, · 163 unmodified lines
164long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)164long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
165{165{
166 struct inode *inode = file_inode(filep);166 struct inode *inode = file_inode(filep);
167 struct smb3_key_debug_info pkey_inf;
167 int rc = -ENOTTY; /* strange error - but the precedent */168 int rc = -ENOTTY; /* strange error - but the precedent */
168 unsigned int xid;169 unsigned int xid;
169 struct cifsFileInfo *pSMBFile = filep->private_data;170 struct cifsFileInfo *pSMBFile = filep->private_data;
@@ -270,6 +271,34 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) · 100 unmodified lines
270 else271 else
271 rc = -EOPNOTSUPP;272 rc = -EOPNOTSUPP;
272 break;273 break;
274 case CIFS_DUMP_KEY:
275 if (pSMBFile == NULL)
276 break;
277 if (!capable(CAP_SYS_ADMIN)) {
278 rc = -EACCES;
279 break;
280 }
281
282 tcon = tlink_tcon(pSMBFile->tlink);
283 if (!smb3_encryption_required(tcon)) {
284 rc = -EOPNOTSUPP;
285 break;
286 }
287 pkey_inf.cipher_type =
288 le16_to_cpu(tcon->ses->server->cipher_type);
289 pkey_inf.Suid = tcon->ses->Suid;
290 memcpy(pkey_inf.auth_key, tcon->ses->auth_key.response,
291 16 /* SMB2_NTLMV2_SESSKEY_SIZE */);
292 memcpy(pkey_inf.smb3decryptionkey,
293 tcon->ses->smb3decryptionkey, SMB3_SIGN_KEY_SIZE);
294 memcpy(pkey_inf.smb3encryptionkey,
295 tcon->ses->smb3encryptionkey, SMB3_SIGN_KEY_SIZE);
296 if (copy_to_user((void __user *)arg, &pkey_inf,
297 sizeof(struct smb3_key_debug_info)))
298 rc = -EFAULT;
299 else
300 rc = 0;
301 break;
273 default:302 default:
274 cifs_dbg(FYI, "unsupported ioctl\n");303 cifs_dbg(FYI, "unsupported ioctl\n");
275 break;304 break;
fs/cifs/sess.c+1−2
@@ -698,7 +698,6 @@ sess_auth_lanman(struct sess_data *sess_data) · 697 unmodified lines
698 char *bcc_ptr;698 char *bcc_ptr;
699 struct cifs_ses *ses = sess_data->ses;699 struct cifs_ses *ses = sess_data->ses;
700 char lnm_session_key[CIFS_AUTH_RESP_SIZE];700 char lnm_session_key[CIFS_AUTH_RESP_SIZE];
701 __u32 capabilities;
702 __u16 bytes_remaining;701 __u16 bytes_remaining;
703 702
704 /* lanman 2 style sessionsetup */703 /* lanman 2 style sessionsetup */
@@ -709,7 +708,7 @@ sess_auth_lanman(struct sess_data *sess_data) · 4 unmodified lines
709 708
710 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base;709 pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base;
711 bcc_ptr = sess_data->iov[2].iov_base;710 bcc_ptr = sess_data->iov[2].iov_base;
712 capabilities = cifs_ssetup_hdr(ses, pSMB);711 (void)cifs_ssetup_hdr(ses, pSMB);
713 712
714 pSMB->req.hdr.Flags2 &= ~SMBFLG2_UNICODE;713 pSMB->req.hdr.Flags2 &= ~SMBFLG2_UNICODE;
715 714
fs/cifs/smb2inode.c+19−15
@@ -51,7 +51,7 @@ static int · 50 unmodified lines
51smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,51smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
52 struct cifs_sb_info *cifs_sb, const char *full_path,52 struct cifs_sb_info *cifs_sb, const char *full_path,
53 __u32 desired_access, __u32 create_disposition,53 __u32 desired_access, __u32 create_disposition,
54 __u32 create_options, void *ptr, int command,54 __u32 create_options, umode_t mode, void *ptr, int command,
55 struct cifsFileInfo *cfile)55 struct cifsFileInfo *cfile)
56{56{
57 int rc;57 int rc;
@@ -103,6 +103,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, · 45 unmodified lines
103 oparms.create_options |= CREATE_OPEN_BACKUP_INTENT;103 oparms.create_options |= CREATE_OPEN_BACKUP_INTENT;
104 oparms.fid = &fid;104 oparms.fid = &fid;
105 oparms.reconnect = false;105 oparms.reconnect = false;
106 oparms.mode = mode;
106 107
107 memset(&open_iov, 0, sizeof(open_iov));108 memset(&open_iov, 0, sizeof(open_iov));
108 rqst[num_rqst].rq_iov = open_iov;109 rqst[num_rqst].rq_iov = open_iov;
@@ -478,7 +479,7 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, · 369 unmodified lines
478 cifs_get_readable_path(tcon, full_path, &cfile);479 cifs_get_readable_path(tcon, full_path, &cfile);
479 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,480 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
480 FILE_READ_ATTRIBUTES, FILE_OPEN, create_options,481 FILE_READ_ATTRIBUTES, FILE_OPEN, create_options,
481 smb2_data, SMB2_OP_QUERY_INFO, cfile);482 ACL_NO_MODE, smb2_data, SMB2_OP_QUERY_INFO, cfile);
482 if (rc == -EOPNOTSUPP) {483 if (rc == -EOPNOTSUPP) {
483 *symlink = true;484 *symlink = true;
484 create_options |= OPEN_REPARSE_POINT;485 create_options |= OPEN_REPARSE_POINT;
@@ -486,8 +487,8 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, · 1 unmodified line
486 /* Failed on a symbolic link - query a reparse point info */487 /* Failed on a symbolic link - query a reparse point info */
487 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,488 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
488 FILE_READ_ATTRIBUTES, FILE_OPEN,489 FILE_READ_ATTRIBUTES, FILE_OPEN,
489 create_options, smb2_data,490 create_options, ACL_NO_MODE,
490 SMB2_OP_QUERY_INFO, NULL);491 smb2_data, SMB2_OP_QUERY_INFO, NULL);
491 }492 }
492 if (rc)493 if (rc)
493 goto out;494 goto out;
@@ -499,12 +500,14 @@ out: · 5 unmodified lines
499}500}
500 501
501int502int
502smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,503smb2_mkdir(const unsigned int xid, struct inode *parent_inode, umode_t mode,
504 struct cifs_tcon *tcon, const char *name,
503 struct cifs_sb_info *cifs_sb)505 struct cifs_sb_info *cifs_sb)
504{506{
505 return smb2_compound_op(xid, tcon, cifs_sb, name,507 return smb2_compound_op(xid, tcon, cifs_sb, name,
506 FILE_WRITE_ATTRIBUTES, FILE_CREATE,508 FILE_WRITE_ATTRIBUTES, FILE_CREATE,
507 CREATE_NOT_FILE, NULL, SMB2_OP_MKDIR, NULL);509 CREATE_NOT_FILE, mode, NULL, SMB2_OP_MKDIR,
510 NULL);
508}511}
509 512
510void513void
@@ -525,8 +528,8 @@ smb2_mkdir_setinfo(struct inode *inode, const char *name, · 14 unmodified lines
525 cifs_get_writable_path(tcon, name, &cfile);528 cifs_get_writable_path(tcon, name, &cfile);
526 tmprc = smb2_compound_op(xid, tcon, cifs_sb, name,529 tmprc = smb2_compound_op(xid, tcon, cifs_sb, name,
527 FILE_WRITE_ATTRIBUTES, FILE_CREATE,530 FILE_WRITE_ATTRIBUTES, FILE_CREATE,
528 CREATE_NOT_FILE, &data, SMB2_OP_SET_INFO,531 CREATE_NOT_FILE, ACL_NO_MODE,
529 cfile);532 &data, SMB2_OP_SET_INFO, cfile);
530 if (tmprc == 0)533 if (tmprc == 0)
531 cifs_i->cifsAttrs = dosattrs;534 cifs_i->cifsAttrs = dosattrs;
532}535}
@@ -536,7 +539,7 @@ smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name, · 3 unmodified lines
536 struct cifs_sb_info *cifs_sb)539 struct cifs_sb_info *cifs_sb)
537{540{
538 return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,541 return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
539 CREATE_NOT_FILE,542 CREATE_NOT_FILE, ACL_NO_MODE,
540 NULL, SMB2_OP_RMDIR, NULL);543 NULL, SMB2_OP_RMDIR, NULL);
541}544}
542 545
@@ -546,7 +549,7 @@ smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, const char *name, · 3 unmodified lines
546{549{
547 return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,550 return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
548 CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT,551 CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT,
549 NULL, SMB2_OP_DELETE, NULL);552 ACL_NO_MODE, NULL, SMB2_OP_DELETE, NULL);
550}553}
551 554
552static int555static int
@@ -564,7 +567,8 @@ smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon, · 11 unmodified lines
564 goto smb2_rename_path;567 goto smb2_rename_path;
565 }568 }
566 rc = smb2_compound_op(xid, tcon, cifs_sb, from_name, access,569 rc = smb2_compound_op(xid, tcon, cifs_sb, from_name, access,
567 FILE_OPEN, 0, smb2_to_name, command, cfile);570 FILE_OPEN, 0, ACL_NO_MODE, smb2_to_name,
571 command, cfile);
568smb2_rename_path:572smb2_rename_path:
569 kfree(smb2_to_name);573 kfree(smb2_to_name);
570 return rc;574 return rc;
@@ -601,8 +605,8 @@ smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon, · 30 unmodified lines
601 __le64 eof = cpu_to_le64(size);605 __le64 eof = cpu_to_le64(size);
602 606
603 return smb2_compound_op(xid, tcon, cifs_sb, full_path,607 return smb2_compound_op(xid, tcon, cifs_sb, full_path,
604 FILE_WRITE_DATA, FILE_OPEN, 0, &eof,608 FILE_WRITE_DATA, FILE_OPEN, 0, ACL_NO_MODE,
605 SMB2_OP_SET_EOF, NULL);609 &eof, SMB2_OP_SET_EOF, NULL);
606}610}
607 611
608int612int
@@ -623,8 +627,8 @@ smb2_set_file_info(struct inode *inode, const char *full_path, · 14 unmodified lines
623 return PTR_ERR(tlink);627 return PTR_ERR(tlink);
624 628
625 rc = smb2_compound_op(xid, tlink_tcon(tlink), cifs_sb, full_path,629 rc = smb2_compound_op(xid, tlink_tcon(tlink), cifs_sb, full_path,
626 FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, buf,630 FILE_WRITE_ATTRIBUTES, FILE_OPEN,
627 SMB2_OP_SET_INFO, NULL);631 0, ACL_NO_MODE, buf, SMB2_OP_SET_INFO, NULL);
628 cifs_put_tlink(tlink);632 cifs_put_tlink(tlink);
629 return rc;633 return rc;
630}634}
fs/cifs/smb2ops.c+10−0
@@ -751,6 +751,8 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid) · 750 unmodified lines
751 goto oshr_exit;751 goto oshr_exit;
752 }752 }
753 753
754 atomic_inc(&tcon->num_remote_opens);
755
754 o_rsp = (struct smb2_create_rsp *)rsp_iov[0].iov_base;756 o_rsp = (struct smb2_create_rsp *)rsp_iov[0].iov_base;
755 oparms.fid->persistent_fid = o_rsp->PersistentFileId;757 oparms.fid->persistent_fid = o_rsp->PersistentFileId;
756 oparms.fid->volatile_fid = o_rsp->VolatileFileId;758 oparms.fid->volatile_fid = o_rsp->VolatileFileId;
@@ -1176,6 +1178,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, · 419 unmodified lines
1176 1178
1177 rc = compound_send_recv(xid, ses, flags, 3, rqst,1179 rc = compound_send_recv(xid, ses, flags, 3, rqst,
1178 resp_buftype, rsp_iov);1180 resp_buftype, rsp_iov);
1181 /* no need to bump num_remote_opens because handle immediately closed */
1179 1182
1180 sea_exit:1183 sea_exit:
1181 kfree(ea);1184 kfree(ea);
@@ -1518,6 +1521,8 @@ smb2_ioctl_query_info(const unsigned int xid, · 336 unmodified lines
1518 resp_buftype, rsp_iov);1521 resp_buftype, rsp_iov);
1519 if (rc)1522 if (rc)
1520 goto iqinf_exit;1523 goto iqinf_exit;
1524
1525 /* No need to bump num_remote_opens since handle immediately closed */
1521 if (qi.flags & PASSTHRU_FSCTL) {1526 if (qi.flags & PASSTHRU_FSCTL) {
1522 pqi = (struct smb_query_info __user *)arg;1527 pqi = (struct smb_query_info __user *)arg;
1523 io_rsp = (struct smb2_ioctl_rsp *)rsp_iov[1].iov_base;1528 io_rsp = (struct smb2_ioctl_rsp *)rsp_iov[1].iov_base;
@@ -3328,6 +3333,11 @@ smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock, · 1804 unmodified lines
3328 if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE)3333 if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE)
3329 return;3334 return;
3330 3335
3336 /* Check if the server granted an oplock rather than a lease */
3337 if (oplock & SMB2_OPLOCK_LEVEL_EXCLUSIVE)
3338 return smb2_set_oplock_level(cinode, oplock, epoch,
3339 purge_cache);
3340
3331 if (oplock & SMB2_LEASE_READ_CACHING_HE) {3341 if (oplock & SMB2_LEASE_READ_CACHING_HE) {
3332 new_oplock |= CIFS_CACHE_READ_FLG;3342 new_oplock |= CIFS_CACHE_READ_FLG;
3333 strcat(message, "R");3343 strcat(message, "R");
fs/cifs/smb2pdu.c+22−1
@@ -751,6 +751,8 @@ add_posix_context(struct kvec *iov, unsigned int *num_iovec, umode_t mode) · 750 unmodified lines
751 unsigned int num = *num_iovec;751 unsigned int num = *num_iovec;
752 752
753 iov[num].iov_base = create_posix_buf(mode);753 iov[num].iov_base = create_posix_buf(mode);
754 if (mode == -1)
755 cifs_dbg(VFS, "illegal mode\n"); /* BB REMOVEME */
754 if (iov[num].iov_base == NULL)756 if (iov[num].iov_base == NULL)
755 return -ENOMEM;757 return -ENOMEM;
756 iov[num].iov_len = sizeof(struct create_posix);758 iov[num].iov_len = sizeof(struct create_posix);
@@ -2352,6 +2354,7 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, · 1595 unmodified lines
2352 rqst.rq_iov = iov;2354 rqst.rq_iov = iov;
2353 rqst.rq_nvec = n_iov;2355 rqst.rq_nvec = n_iov;
2354 2356
2357 /* no need to inc num_remote_opens because we close it just below */
2355 trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, CREATE_NOT_FILE,2358 trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, CREATE_NOT_FILE,
2356 FILE_WRITE_ATTRIBUTES);2359 FILE_WRITE_ATTRIBUTES);
2357 /* resource #4: response buffer */2360 /* resource #4: response buffer */
@@ -2416,6 +2419,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, __u8 *oplock, · 58 unmodified lines
2416 /* File attributes ignored on open (used in create though) */2419 /* File attributes ignored on open (used in create though) */
2417 req->FileAttributes = cpu_to_le32(file_attributes);2420 req->FileAttributes = cpu_to_le32(file_attributes);
2418 req->ShareAccess = FILE_SHARE_ALL_LE;2421 req->ShareAccess = FILE_SHARE_ALL_LE;
2422
2419 req->CreateDisposition = cpu_to_le32(oparms->disposition);2423 req->CreateDisposition = cpu_to_le32(oparms->disposition);
2420 req->CreateOptions = cpu_to_le32(oparms->create_options & CREATE_OPTIONS_MASK);2424 req->CreateOptions = cpu_to_le32(oparms->create_options & CREATE_OPTIONS_MASK);
2421 req->NameOffset = cpu_to_le16(sizeof(struct smb2_create_req));2425 req->NameOffset = cpu_to_le16(sizeof(struct smb2_create_req));
@@ -2517,6 +2521,23 @@ SMB2_open_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, __u8 *oplock, · 95 unmodified lines
2517 return rc;2521 return rc;
2518 }2522 }
2519 2523
2524 /* TODO: add handling for the mode on create */
2525 if (oparms->disposition == FILE_CREATE)
2526 cifs_dbg(VFS, "mode is 0x%x\n", oparms->mode); /* BB REMOVEME */
2527
2528 if ((oparms->disposition == FILE_CREATE) && (oparms->mode != -1)) {
2529 if (n_iov > 2) {
2530 struct create_context *ccontext =
2531 (struct create_context *)iov[n_iov-1].iov_base;
2532 ccontext->Next =
2533 cpu_to_le32(iov[n_iov-1].iov_len);
2534 }
2535
2536 /* rc = add_sd_context(iov, &n_iov, oparms->mode); */
2537 if (rc)
2538 return rc;
2539 }
2540
2520 if (n_iov > 2) {2541 if (n_iov > 2) {
2521 struct create_context *ccontext =2542 struct create_context *ccontext =
2522 (struct create_context *)iov[n_iov-1].iov_base;2543 (struct create_context *)iov[n_iov-1].iov_base;
@@ -3180,7 +3201,7 @@ SMB2_get_srv_num(const unsigned int xid, struct cifs_tcon *tcon, · 657 unmodified lines
3180 * See MS-SMB2 2.2.35 and 2.2.363201 * See MS-SMB2 2.2.35 and 2.2.36
3181 */3202 */
3182 3203
3183int3204static int
3184SMB2_notify_init(const unsigned int xid, struct smb_rqst *rqst,3205SMB2_notify_init(const unsigned int xid, struct smb_rqst *rqst,
3185 struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid,3206 struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid,
3186 u32 completion_filter, bool watch_tree)3207 u32 completion_filter, bool watch_tree)
fs/cifs/smb2proto.h+2−1
@@ -84,7 +84,8 @@ extern int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, · 83 unmodified lines
84 umode_t mode, struct cifs_tcon *tcon,84 umode_t mode, struct cifs_tcon *tcon,
85 const char *full_path,85 const char *full_path,
86 struct cifs_sb_info *cifs_sb);86 struct cifs_sb_info *cifs_sb);
87extern int smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon,87extern int smb2_mkdir(const unsigned int xid, struct inode *inode,
88 umode_t mode, struct cifs_tcon *tcon,
88 const char *name, struct cifs_sb_info *cifs_sb);89 const char *name, struct cifs_sb_info *cifs_sb);
89extern void smb2_mkdir_setinfo(struct inode *inode, const char *full_path,90extern void smb2_mkdir_setinfo(struct inode *inode, const char *full_path,
90 struct cifs_sb_info *cifs_sb,91 struct cifs_sb_info *cifs_sb,
fs/cifs/smbfsctl.h+11−0
@@ -144,6 +144,17 @@ · 143 unmodified lines
144#define IO_REPARSE_APPXSTREAM 0xC0000014144#define IO_REPARSE_APPXSTREAM 0xC0000014
145/* NFS symlinks, Win 8/SMB3 and later */145/* NFS symlinks, Win 8/SMB3 and later */
146#define IO_REPARSE_TAG_NFS 0x80000014146#define IO_REPARSE_TAG_NFS 0x80000014
147/*
148 * AzureFileSync - see
149 * https://docs.microsoft.com/en-us/azure/storage/files/storage-sync-cloud-tiering
150 */
151#define IO_REPARSE_TAG_AZ_FILE_SYNC 0x8000001e
152/* WSL reparse tags */
153#define IO_REPARSE_TAG_LX_SYMLINK 0xA000001D
154#define IO_REPARSE_TAG_AF_UNIX 0x80000023
155#define IO_REPARSE_TAG_LX_FIFO 0x80000024
156#define IO_REPARSE_TAG_LX_CHR 0x80000025
157#define IO_REPARSE_TAG_LX_BLK 0x80000026
147 158
148/* fsctl flags */159/* fsctl flags */
149/* If Flags is set to this value, the request is an FSCTL not ioctl request */160/* If Flags is set to this value, the request is an FSCTL not ioctl request */
fs/cifs/xattr.c+1−1
@@ -31,7 +31,7 @@ · 30 unmodified lines
31#include "cifs_fs_sb.h"31#include "cifs_fs_sb.h"
32#include "cifs_unicode.h"32#include "cifs_unicode.h"
33 33
34#define MAX_EA_VALUE_SIZE 6553534#define MAX_EA_VALUE_SIZE CIFSMaxBufSize
35#define CIFS_XATTR_CIFS_ACL "system.cifs_acl"35#define CIFS_XATTR_CIFS_ACL "system.cifs_acl"
36#define CIFS_XATTR_ATTRIB "cifs.dosattrib" /* full name: user.cifs.dosattrib */36#define CIFS_XATTR_ATTRIB "cifs.dosattrib" /* full name: user.cifs.dosattrib */
37#define CIFS_XATTR_CREATETIME "cifs.creationtime" /* user.cifs.creationtime */37#define CIFS_XATTR_CREATETIME "cifs.creationtime" /* user.cifs.creationtime */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t