Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 31ba433

Browse files
committedMar 15, 2019
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>
1 parent 779ede0 commit 31ba433

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed
 

‎fs/cifs/cifs_ioctl.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ struct smb_snapshot_array {
4343
/* snapshots[]; */
4444
} __packed;
4545

46+
/* query_info flags */
47+
#define PASSTHRU_QUERY_INFO 0x00000000
48+
#define PASSTHRU_FSCTL 0x00000001
4649
struct smb_query_info {
4750
__u32 info_type;
4851
__u32 file_info_class;

‎fs/cifs/smb2ops.c‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,15 +1390,27 @@ smb2_ioctl_query_info(const unsigned int xid,
13901390
smb2_set_next_command(tcon, &rqst[0]);
13911391

13921392
/* Query */
1393-
memset(&qi_iov, 0, sizeof(qi_iov));
1394-
rqst[1].rq_iov = qi_iov;
1395-
rqst[1].rq_nvec = 1;
1396-
1397-
rc = SMB2_query_info_init(tcon, &rqst[1], COMPOUND_FID, COMPOUND_FID,
1398-
qi.file_info_class, qi.info_type,
1399-
qi.additional_information,
1393+
if (qi.flags & PASSTHRU_FSCTL) {
1394+
/* Can eventually relax perm check since server enforces too */
1395+
if (!capable(CAP_SYS_ADMIN))
1396+
rc = -EPERM;
1397+
else /* TBD: Add code to compound FSCTL */
1398+
rc = -EOPNOTSUPP;
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,
14001407
qi.input_buffer_length,
14011408
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+
14021414
if (rc)
14031415
goto iqinf_exit;
14041416
smb2_set_next_command(tcon, &rqst[1]);

0 commit comments

Comments
 (0)
Failed to load comments.