]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb3: fix ksmbd bigendian bug in oplock break, and move its struct to smbfs_common
authorSteve French <stfrench@microsoft.com>
Mon, 18 Dec 2023 15:32:50 +0000 (00:32 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Dec 2023 09:41:51 +0000 (10:41 +0100)
[ Upstream commit c7803b05f74bc3941b127f3155671e1944f632ae ]

Fix an endian bug in ksmbd for one remaining use of
Persistent/VolatileFid that unnecessarily converted it (it is an
opaque endian field that does not need to be and should not
be converted) in oplock_break for ksmbd, and move the definitions
for the oplock and lease break protocol requests and responses
to fs/smbfs_common/smb2pdu.h

Also move a few more definitions for various protocol requests
that were duplicated (in fs/cifs/smb2pdu.h and fs/ksmbd/smb2pdu.h)
into fs/smbfs_common/smb2pdu.h including:

- various ioctls and reparse structures
- validate negotiate request and response structs
- duplicate extents structs

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ksmbd/oplock.c
fs/ksmbd/smb2pdu.c

index e1d854609195a3480d21a9dba2db46c4f72d4b95..2e52ebc209d278e800ed0d1f7ac06b8bffdc899f 100644 (file)
@@ -657,8 +657,8 @@ static void __smb2_oplock_break_noti(struct work_struct *wk)
                rsp->OplockLevel = SMB2_OPLOCK_LEVEL_NONE;
        rsp->Reserved = 0;
        rsp->Reserved2 = 0;
-       rsp->PersistentFid = cpu_to_le64(fp->persistent_id);
-       rsp->VolatileFid = cpu_to_le64(fp->volatile_id);
+       rsp->PersistentFid = fp->persistent_id;
+       rsp->VolatileFid = fp->volatile_id;
 
        inc_rfc1001_len(work->response_buf, 24);
 
index ee58f6c2d09ec42dea2af01400ad37839c852023..ca10bf1fddbfbe7402385a3f4178635e89f73398 100644 (file)
@@ -7996,8 +7996,8 @@ static void smb20_oplock_break_ack(struct ksmbd_work *work)
        char req_oplevel = 0, rsp_oplevel = 0;
        unsigned int oplock_change_type;
 
-       volatile_id = le64_to_cpu(req->VolatileFid);
-       persistent_id = le64_to_cpu(req->PersistentFid);
+       volatile_id = req->VolatileFid;
+       persistent_id = req->PersistentFid;
        req_oplevel = req->OplockLevel;
        ksmbd_debug(OPLOCK, "v_id %llu, p_id %llu request oplock level %d\n",
                    volatile_id, persistent_id, req_oplevel);
@@ -8092,8 +8092,8 @@ static void smb20_oplock_break_ack(struct ksmbd_work *work)
        rsp->OplockLevel = rsp_oplevel;
        rsp->Reserved = 0;
        rsp->Reserved2 = 0;
-       rsp->VolatileFid = cpu_to_le64(volatile_id);
-       rsp->PersistentFid = cpu_to_le64(persistent_id);
+       rsp->VolatileFid = volatile_id;
+       rsp->PersistentFid = persistent_id;
        inc_rfc1001_len(work->response_buf, 24);
        return;