diff mbox series

[CIFS] fix incorrect size for query_on_disk_id

Message ID CAH2r5ms+mTNU746nkbAjb9FOdiaAcK9rQK76NMv6Njd0MsDq7A@mail.gmail.com
State New
Headers show
Series [CIFS] fix incorrect size for query_on_disk_id | expand

Commit Message

Steve French April 28, 2023, 5:24 a.m. UTC
We were assuming the wrong size for the struct, use the ksmbd
    version of this struct and move it to common code.

Comments

Steve French April 28, 2023, 5:48 a.m. UTC | #1
forgot to remove the old incorrect struct (now unused).  Patch fixed
and reattached

On Fri, Apr 28, 2023 at 12:24 AM Steve French <smfrench@gmail.com> wrote:
>
> We were assuming the wrong size for the struct, use the ksmbd
>     version of this struct and move it to common code.
>
>
>
> --
> Thanks,
>
> Steve
Steve French April 29, 2023, 2:30 a.m. UTC | #2
As Paulo pointed out - size was not incorrect, just confusing when the
two structs (cifs and ksmbd)
differed.  I fixed the patch description.

On Fri, Apr 28, 2023 at 12:48 AM Steve French <smfrench@gmail.com> wrote:
>
> forgot to remove the old incorrect struct (now unused).  Patch fixed
> and reattached
>
> On Fri, Apr 28, 2023 at 12:24 AM Steve French <smfrench@gmail.com> wrote:
> >
> > We were assuming the wrong size for the struct, use the ksmbd
> >     version of this struct and move it to common code.
> >
> >
> >
> > --
> > Thanks,
> >
> > Steve
>
>
>
> --
> Thanks,
>
> Steve
Steve French April 29, 2023, 2:31 a.m. UTC | #3
attached wrong patch - resending with right attachment


On Fri, Apr 28, 2023 at 9:30 PM Steve French <smfrench@gmail.com> wrote:
>
> As Paulo pointed out - size was not incorrect, just confusing when the
> two structs (cifs and ksmbd)
> differed.  I fixed the patch description.
>
> On Fri, Apr 28, 2023 at 12:48 AM Steve French <smfrench@gmail.com> wrote:
> >
> > forgot to remove the old incorrect struct (now unused).  Patch fixed
> > and reattached
> >
> > On Fri, Apr 28, 2023 at 12:24 AM Steve French <smfrench@gmail.com> wrote:
> > >
> > > We were assuming the wrong size for the struct, use the ksmbd
> > >     version of this struct and move it to common code.
> > >
> > >
> > >
> > > --
> > > Thanks,
> > >
> > > Steve
> >
> >
> >
> > --
> > Thanks,
> >
> > Steve
>
>
>
> --
> Thanks,
>
> Steve
Namjae Jeon May 2, 2023, 5:54 a.m. UTC | #4
2023-04-29 11:31 GMT+09:00, Steve French <smfrench@gmail.com>:
> attached wrong patch - resending with right attachment
Acked-by: Namjae Jeon <linkinjeon@kernel.org>

Thanks!
>
>
> On Fri, Apr 28, 2023 at 9:30 PM Steve French <smfrench@gmail.com> wrote:
>>
>> As Paulo pointed out - size was not incorrect, just confusing when the
>> two structs (cifs and ksmbd)
>> differed.  I fixed the patch description.
>>
>> On Fri, Apr 28, 2023 at 12:48 AM Steve French <smfrench@gmail.com> wrote:
>> >
>> > forgot to remove the old incorrect struct (now unused).  Patch fixed
>> > and reattached
>> >
>> > On Fri, Apr 28, 2023 at 12:24 AM Steve French <smfrench@gmail.com>
>> > wrote:
>> > >
>> > > We were assuming the wrong size for the struct, use the ksmbd
>> > >     version of this struct and move it to common code.
>> > >
>> > >
>> > >
>> > > --
>> > > Thanks,
>> > >
>> > > Steve
>> >
>> >
>> >
>> > --
>> > Thanks,
>> >
>> > Steve
>>
>>
>>
>> --
>> Thanks,
>>
>> Steve
>
>
>
> --
> Thanks,
>
> Steve
>
diff mbox series

Patch

From b1e5a95a07cdcc755a00ee0c3fc9187b77109c1f Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Fri, 28 Apr 2023 00:21:10 -0500
Subject: [PATCH] smb3: fix incorrect size for query_on_disk_id open context

We were assuming the wrong size for the struct, use the ksmbd
version of this struct and move it to common code.

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2pdu.c         |  2 +-
 fs/ksmbd/smb2pdu.h        |  8 --------
 fs/smbfs_common/smb2pdu.h | 11 +++++++++++
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 281e0b12658d..0521aa1da644 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2063,7 +2063,7 @@  create_reconnect_durable_buf(struct cifs_fid *fid)
 static void
 parse_query_id_ctxt(struct create_context *cc, struct smb2_file_all_info *buf)
 {
-	struct create_on_disk_id *pdisk_id = (struct create_on_disk_id *)cc;
+	struct create_disk_id_rsp *pdisk_id = (struct create_disk_id_rsp *)cc;
 
 	cifs_dbg(FYI, "parse query id context 0x%llx 0x%llx\n",
 		pdisk_id->DiskFileId, pdisk_id->VolumeId);
diff --git a/fs/ksmbd/smb2pdu.h b/fs/ksmbd/smb2pdu.h
index 9420dd2813fb..bcf71fd4dc1e 100644
--- a/fs/ksmbd/smb2pdu.h
+++ b/fs/ksmbd/smb2pdu.h
@@ -144,14 +144,6 @@  struct create_mxac_rsp {
 	__le32 MaximalAccess;
 } __packed;
 
-struct create_disk_id_rsp {
-	struct create_context ccontext;
-	__u8   Name[8];
-	__le64 DiskFileId;
-	__le64 VolumeId;
-	__u8  Reserved[16];
-} __packed;
-
 /* equivalent of the contents of SMB3.1.1 POSIX open context response */
 struct create_posix_rsp {
 	struct create_context ccontext;
diff --git a/fs/smbfs_common/smb2pdu.h b/fs/smbfs_common/smb2pdu.h
index ace133cf6072..eab801ee5cf3 100644
--- a/fs/smbfs_common/smb2pdu.h
+++ b/fs/smbfs_common/smb2pdu.h
@@ -1180,6 +1180,7 @@  struct create_posix {
 
 #define SMB2_LEASE_KEY_SIZE			16
 
+/* See MS-SMB2 2.2.13.2.8 */
 struct lease_context {
 	__u8 LeaseKey[SMB2_LEASE_KEY_SIZE];
 	__le32 LeaseState;
@@ -1187,6 +1188,7 @@  struct lease_context {
 	__le64 LeaseDuration;
 } __packed;
 
+/* See MS-SMB2 2.2.13.2.10 */
 struct lease_context_v2 {
 	__u8 LeaseKey[SMB2_LEASE_KEY_SIZE];
 	__le32 LeaseState;
@@ -1210,6 +1212,15 @@  struct create_lease_v2 {
 	__u8   Pad[4];
 } __packed;
 
+/* See MS-SMB2 2.2.14.2.9 */
+struct create_disk_id_rsp {
+	struct create_context ccontext;
+	__u8   Name[8];
+	__le64 DiskFileId;
+	__le64 VolumeId;
+	__u8  Reserved[16];
+} __packed;
+
 /* See MS-SMB2 2.2.31 and 2.2.32 */
 struct smb2_ioctl_req {
 	struct smb2_hdr hdr;
-- 
2.34.1