Re: [PATCH] cifs: Add support for FSCTL passthrough that write data to the server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How about this small followon patch to address this?


On Thu, Apr 11, 2019 at 12:49 PM Pavel Shilovsky <piastryyy@xxxxxxxxx> wrote:
>
> ср, 10 апр. 2019 г. в 19:21, Ronnie Sahlberg <lsahlber@xxxxxxxxxx>:
> >
> > Add support to pass a blob to the server in FSCTL passthrough.
> >
> > Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
> > ---
> >  fs/cifs/smb2ops.c  | 17 +++++++++++++++--
> >  fs/cifs/smbfsctl.h | 27 +++++++++++++++++++++++++++
> >  2 files changed, 42 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> > index 83a100dd2497..bb7522b882ea 100644
> > --- a/fs/cifs/smb2ops.c
> > +++ b/fs/cifs/smb2ops.c
> > @@ -1382,6 +1382,18 @@ smb2_ioctl_query_info(const unsigned int xid,
> >         oparms.fid = &fid;
> >         oparms.reconnect = false;
> >
> > +       /*
> > +        * FSCTL codes encode the special access they need in the fsctl code.
> > +        */
> > +       if (qi.flags & PASSTHRU_FSCTL) {
> > +               switch (qi.info_type & FSCTL_DEVICE_ACCESS_MASK) {
> > +               case FSCTL_DEVICE_ACCESS_FILE_READ_WRITE_ACCESS:
> > +                       oparms.desired_access = FILE_READ_DATA | FILE_WRITE_DATA | FILE_READ_ATTRIBUTES | SYNCHRONIZE;
> > +                       ;
>
> This extra ":" looks unnecessary. Don't we need to add cases for
> +#define FSCTL_DEVICE_ACCESS_FILE_ANY_ACCESS        (0x00 << 14)
> +#define FSCTL_DEVICE_ACCESS_FILE_READ_ACCESS       (0x01 << 14)
> +#define FSCTL_DEVICE_ACCESS_FILE_WRITE_ACCESS      (0x02 << 14)
> ?
>
> --
> Best regards,
> Pavel Shilovsky



-- 
Thanks,

Steve
From 2f1490f506b583f1533e7165adc7f21eaa01df22 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Thu, 11 Apr 2019 13:53:17 -0500
Subject: [PATCH] SMB3: Add handling for different FSCTL access flags

DesiredAccess field in SMB3 open request needs
to be set differently for READ vs. WRITE ioctls
(not just ones that request both).

Originally noticed by Pavel

Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
---
 fs/cifs/smb2ops.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index ed8c2ba9590b..08ff044fbb4b 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1389,7 +1389,15 @@ smb2_ioctl_query_info(const unsigned int xid,
 		switch (qi.info_type & FSCTL_DEVICE_ACCESS_MASK) {
 		case FSCTL_DEVICE_ACCESS_FILE_READ_WRITE_ACCESS:
 			oparms.desired_access = FILE_READ_DATA | FILE_WRITE_DATA | FILE_READ_ATTRIBUTES | SYNCHRONIZE;
-			;
+			break;
+		case FSCTL_DEVICE_ACCESS_FILE_ANY_ACCESS:
+			oparms.desired_access = GENERIC_ALL;
+			break;
+		case FSCTL_DEVICE_ACCESS_FILE_READ_ACCESS:
+			oparms.desired_access = GENERIC_READ;
+			break;
+		case FSCTL_DEVICE_ACCESS_FILE_WRITE_ACCESS:
+			oparms.desired_access = GENERIC_WRITE;
 			break;
 		}
 	}
-- 
2.17.1


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux