* [PATCH][CIFS] fix incorrect size for query_on_disk_id
@ 2023-04-28 5:24 Steve French
2023-04-28 5:48 ` Steve French
0 siblings, 1 reply; 5+ messages in thread
From: Steve French @ 2023-04-28 5:24 UTC (permalink / raw)
To: CIFS; +Cc: Namjae Jeon
[-- Attachment #1: Type: text/plain, Size: 139 bytes --]
We were assuming the wrong size for the struct, use the ksmbd
version of this struct and move it to common code.
--
Thanks,
Steve
[-- Attachment #2: 0001-smb3-fix-incorrect-size-for-query_on_disk_id-open-co.patch --]
[-- Type: text/x-patch, Size: 2584 bytes --]
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH][CIFS] fix incorrect size for query_on_disk_id
2023-04-28 5:24 [PATCH][CIFS] fix incorrect size for query_on_disk_id Steve French
@ 2023-04-28 5:48 ` Steve French
2023-04-29 2:30 ` Steve French
0 siblings, 1 reply; 5+ messages in thread
From: Steve French @ 2023-04-28 5:48 UTC (permalink / raw)
To: CIFS; +Cc: Namjae Jeon
[-- Attachment #1: Type: text/plain, Size: 358 bytes --]
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
[-- Attachment #2: 0001-smb3-fix-incorrect-size-for-query_on_disk_id-open-co.patch --]
[-- Type: text/x-patch, Size: 3175 bytes --]
From 614f215c7b7371ac76aa8b234b21b597c0680100 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/cifs/smb2pdu.h | 9 ---------
fs/ksmbd/smb2pdu.h | 8 --------
fs/smbfs_common/smb2pdu.h | 11 +++++++++++
4 files changed, 12 insertions(+), 18 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/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index 2114e8a0c63a..efe55a572e4c 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -170,15 +170,6 @@ struct durable_reconnect_context_v2 {
__le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
} __packed;
-/* See MS-SMB2 2.2.14.2.9 */
-struct create_on_disk_id {
- struct create_context ccontext;
- __u8 Name[8];
- __le64 DiskFileId;
- __le64 VolumeId;
- __u32 Reserved[4];
-} __packed;
-
/* See MS-SMB2 2.2.14.2.12 */
struct durable_reconnect_context_v2_rsp {
__le32 Timeout;
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH][CIFS] fix incorrect size for query_on_disk_id
2023-04-28 5:48 ` Steve French
@ 2023-04-29 2:30 ` Steve French
2023-04-29 2:31 ` Steve French
0 siblings, 1 reply; 5+ messages in thread
From: Steve French @ 2023-04-29 2:30 UTC (permalink / raw)
To: CIFS; +Cc: Namjae Jeon
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
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
[-- Attachment #2: 0001-smb3-move-some-common-open-context-structs-to-smbfs_.patch --]
[-- Type: text/x-patch, Size: 3397 bytes --]
From f84be398fe83b79aa6c50a6c469cb25fe2562e97 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Fri, 28 Apr 2023 00:41:58 -0500
Subject: [PATCH] smb3: move some common open context structs to smbfs_common
create durable and create durable reconnect context and the maximal
access create context struct definitions can be put in common code in
smbfs_common
Signed-off-by: Steve French <stfrench@microsoft.com>
---
fs/cifs/smb2pdu.h | 11 -----------
fs/ksmbd/smb2pdu.h | 25 -------------------------
fs/smbfs_common/smb2pdu.h | 28 ++++++++++++++++++++++++++++
3 files changed, 28 insertions(+), 36 deletions(-)
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index efe55a572e4c..220994d0a0f7 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -132,17 +132,6 @@ struct share_redirect_error_context_rsp {
#define SMB2_LEASE_HANDLE_CACHING_HE 0x02
#define SMB2_LEASE_WRITE_CACHING_HE 0x04
-struct create_durable {
- struct create_context ccontext;
- __u8 Name[8];
- union {
- __u8 Reserved[16];
- struct {
- __u64 PersistentFileId;
- __u64 VolatileFileId;
- } Fid;
- } Data;
-} __packed;
/* See MS-SMB2 2.2.13.2.11 */
/* Flags */
diff --git a/fs/ksmbd/smb2pdu.h b/fs/ksmbd/smb2pdu.h
index bcf71fd4dc1e..67dc552f2ef7 100644
--- a/fs/ksmbd/smb2pdu.h
+++ b/fs/ksmbd/smb2pdu.h
@@ -70,18 +70,6 @@ struct create_durable_req_v2 {
__u8 CreateGuid[16];
} __packed;
-struct create_durable_reconn_req {
- struct create_context ccontext;
- __u8 Name[8];
- union {
- __u8 Reserved[16];
- struct {
- __u64 PersistentFileId;
- __u64 VolatileFileId;
- } Fid;
- } Data;
-} __packed;
-
struct create_durable_reconn_v2_req {
struct create_context ccontext;
__u8 Name[8];
@@ -109,12 +97,6 @@ struct create_app_inst_id_vers {
__le64 AppInstanceVersionLow;
} __packed;
-struct create_mxac_req {
- struct create_context ccontext;
- __u8 Name[8];
- __le64 Timestamp;
-} __packed;
-
struct create_alloc_size_req {
struct create_context ccontext;
__u8 Name[8];
@@ -137,13 +119,6 @@ struct create_durable_v2_rsp {
__le32 Flags;
} __packed;
-struct create_mxac_rsp {
- struct create_context ccontext;
- __u8 Name[8];
- __le32 QueryStatus;
- __le32 MaximalAccess;
-} __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 43c92e898ee9..3b43a51e6f7e 100644
--- a/fs/smbfs_common/smb2pdu.h
+++ b/fs/smbfs_common/smb2pdu.h
@@ -1172,6 +1172,34 @@ struct create_posix {
__u32 Reserved;
} __packed;
+/* See MS-SMB2 2.2.13.2.3 and MS-SMB2 2.2.13.2.4 */
+struct create_durable {
+ struct create_context ccontext;
+ __u8 Name[8];
+ union {
+ __u8 Reserved[16];
+ struct {
+ __u64 PersistentFileId;
+ __u64 VolatileFileId;
+ } Fid;
+ } Data;
+} __packed;
+
+/* See MS-SMB2 2.2.13.2.5 */
+struct create_mxac_req {
+ struct create_context ccontext;
+ __u8 Name[8];
+ __le64 Timestamp;
+} __packed;
+
+/* See MS-SMB2 2.2.14.2.5 */
+struct create_mxac_rsp {
+ struct create_context ccontext;
+ __u8 Name[8];
+ __le32 QueryStatus;
+ __le32 MaximalAccess;
+} __packed;
+
#define SMB2_LEASE_NONE_LE cpu_to_le32(0x00)
#define SMB2_LEASE_READ_CACHING_LE cpu_to_le32(0x01)
#define SMB2_LEASE_HANDLE_CACHING_LE cpu_to_le32(0x02)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH][CIFS] fix incorrect size for query_on_disk_id
2023-04-29 2:30 ` Steve French
@ 2023-04-29 2:31 ` Steve French
2023-05-02 5:54 ` Namjae Jeon
0 siblings, 1 reply; 5+ messages in thread
From: Steve French @ 2023-04-29 2:31 UTC (permalink / raw)
To: CIFS; +Cc: Namjae Jeon
[-- Attachment #1: Type: text/plain, Size: 880 bytes --]
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
--
Thanks,
Steve
[-- Attachment #2: 0001-smb3-make-query_on_disk_id-open-context-consistent-a.patch --]
[-- Type: text/x-patch, Size: 3262 bytes --]
From 937f3064987620647b8feeee6fbe6c49a16725dd Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Fri, 28 Apr 2023 00:21:10 -0500
Subject: [PATCH 1/2] smb3: make query_on_disk_id open context consistent and
move to common code
cifs and ksmbd were using a slightly different version of the query_on_disk_id
struct which could be confusing. 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/cifs/smb2pdu.h | 9 ---------
fs/ksmbd/smb2pdu.h | 8 --------
fs/smbfs_common/smb2pdu.h | 11 +++++++++++
4 files changed, 12 insertions(+), 18 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/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index 2114e8a0c63a..efe55a572e4c 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -170,15 +170,6 @@ struct durable_reconnect_context_v2 {
__le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
} __packed;
-/* See MS-SMB2 2.2.14.2.9 */
-struct create_on_disk_id {
- struct create_context ccontext;
- __u8 Name[8];
- __le64 DiskFileId;
- __le64 VolumeId;
- __u32 Reserved[4];
-} __packed;
-
/* See MS-SMB2 2.2.14.2.12 */
struct durable_reconnect_context_v2_rsp {
__le32 Timeout;
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 334f11ed5146..43c92e898ee9 100644
--- a/fs/smbfs_common/smb2pdu.h
+++ b/fs/smbfs_common/smb2pdu.h
@@ -1181,6 +1181,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;
@@ -1188,6 +1189,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;
@@ -1211,6 +1213,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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH][CIFS] fix incorrect size for query_on_disk_id
2023-04-29 2:31 ` Steve French
@ 2023-05-02 5:54 ` Namjae Jeon
0 siblings, 0 replies; 5+ messages in thread
From: Namjae Jeon @ 2023-05-02 5:54 UTC (permalink / raw)
To: Steve French; +Cc: CIFS
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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-02 5:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-28 5:24 [PATCH][CIFS] fix incorrect size for query_on_disk_id Steve French
2023-04-28 5:48 ` Steve French
2023-04-29 2:30 ` Steve French
2023-04-29 2:31 ` Steve French
2023-05-02 5:54 ` Namjae Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).