diff options
author | Steve French <stfrench@microsoft.com> | 2019-03-13 03:40:07 -0400 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2019-03-14 20:32:36 -0400 |
commit | 31ba4331d571f501fb32ae072478787e77baf52a (patch) | |
tree | 19767fc3d3b0ae4ccb5245b3121d9dec3e585f39 | |
parent | 779ede040dd491acdb076ed9660d7160228949fd (diff) |
SMB3: passthru query info doesn't check for SMB3 FSCTL passthru
The passthrough queries from user space tools like smbinfo can be either
SMB3 QUERY_INFO or SMB3 FSCTL, but we are not checking for the latter.
Temporarily we return EOPNOTSUPP for SMB3 FSCTL passthrough requests
but once compounding fsctls is fixed can enable.
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
-rw-r--r-- | fs/cifs/cifs_ioctl.h | 3 | ||||
-rw-r--r-- | fs/cifs/smb2ops.c | 26 |
2 files changed, 22 insertions, 7 deletions
diff --git a/fs/cifs/cifs_ioctl.h b/fs/cifs/cifs_ioctl.h index d8bce2f862de..086ddc5108af 100644 --- a/fs/cifs/cifs_ioctl.h +++ b/fs/cifs/cifs_ioctl.h | |||
@@ -43,6 +43,9 @@ struct smb_snapshot_array { | |||
43 | /* snapshots[]; */ | 43 | /* snapshots[]; */ |
44 | } __packed; | 44 | } __packed; |
45 | 45 | ||
46 | /* query_info flags */ | ||
47 | #define PASSTHRU_QUERY_INFO 0x00000000 | ||
48 | #define PASSTHRU_FSCTL 0x00000001 | ||
46 | struct smb_query_info { | 49 | struct smb_query_info { |
47 | __u32 info_type; | 50 | __u32 info_type; |
48 | __u32 file_info_class; | 51 | __u32 file_info_class; |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 823a58550dfd..32dde87feaa9 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -1390,15 +1390,27 @@ smb2_ioctl_query_info(const unsigned int xid, | |||
1390 | smb2_set_next_command(tcon, &rqst[0]); | 1390 | smb2_set_next_command(tcon, &rqst[0]); |
1391 | 1391 | ||
1392 | /* Query */ | 1392 | /* Query */ |
1393 | memset(&qi_iov, 0, sizeof(qi_iov)); | 1393 | if (qi.flags & PASSTHRU_FSCTL) { |
1394 | rqst[1].rq_iov = qi_iov; | 1394 | /* Can eventually relax perm check since server enforces too */ |
1395 | rqst[1].rq_nvec = 1; | 1395 | if (!capable(CAP_SYS_ADMIN)) |
1396 | 1396 | rc = -EPERM; | |
1397 | rc = SMB2_query_info_init(tcon, &rqst[1], COMPOUND_FID, COMPOUND_FID, | 1397 | else /* TBD: Add code to compound FSCTL */ |
1398 | qi.file_info_class, qi.info_type, | 1398 | rc = -EOPNOTSUPP; |
1399 | qi.additional_information, | 1399 | } else if (qi.flags == PASSTHRU_QUERY_INFO) { |
1400 | memset(&qi_iov, 0, sizeof(qi_iov)); | ||
1401 | rqst[1].rq_iov = qi_iov; | ||
1402 | rqst[1].rq_nvec = 1; | ||
1403 | |||
1404 | rc = SMB2_query_info_init(tcon, &rqst[1], COMPOUND_FID, | ||
1405 | COMPOUND_FID, qi.file_info_class, | ||
1406 | qi.info_type, qi.additional_information, | ||
1400 | qi.input_buffer_length, | 1407 | qi.input_buffer_length, |
1401 | qi.output_buffer_length, buffer); | 1408 | qi.output_buffer_length, buffer); |
1409 | } else { /* unknown flags */ | ||
1410 | cifs_dbg(VFS, "invalid passthru query flags: 0x%x\n", qi.flags); | ||
1411 | rc = -EINVAL; | ||
1412 | } | ||
1413 | |||
1402 | if (rc) | 1414 | if (rc) |
1403 | goto iqinf_exit; | 1415 | goto iqinf_exit; |
1404 | smb2_set_next_command(tcon, &rqst[1]); | 1416 | smb2_set_next_command(tcon, &rqst[1]); |