From: Namjae Jeon <linkinjeon@kernel.org>
To: linux-cifs@vger.kernel.org
Cc: Namjae Jeon <linkinjeon@kernel.org>, Ralph Boehme <slow@samba.org>
Subject: [PATCH v4 3/9] ksmbd: use correct basic info level in set_file_basic_info()
Date: Wed, 29 Sep 2021 17:44:55 +0900 [thread overview]
Message-ID: <20210929084501.94846-4-linkinjeon@kernel.org> (raw)
In-Reply-To: <20210929084501.94846-1-linkinjeon@kernel.org>
Use correct basic info level in set/get_file_basic_info().
Reviewed-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
fs/ksmbd/smb2pdu.c | 13 ++++++-------
fs/ksmbd/smb2pdu.h | 9 +++++++++
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 9c0878862820..d874813aca90 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -4161,7 +4161,7 @@ static void get_file_access_info(struct smb2_query_info_rsp *rsp,
static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
struct ksmbd_file *fp, void *rsp_org)
{
- struct smb2_file_all_info *basic_info;
+ struct smb2_file_basic_info *basic_info;
struct kstat stat;
u64 time;
@@ -4171,7 +4171,7 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
return -EACCES;
}
- basic_info = (struct smb2_file_all_info *)rsp->Buffer;
+ basic_info = (struct smb2_file_basic_info *)rsp->Buffer;
generic_fillattr(file_mnt_user_ns(fp->filp), file_inode(fp->filp),
&stat);
basic_info->CreationTime = cpu_to_le64(fp->create_time);
@@ -4184,9 +4184,8 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
basic_info->Attributes = fp->f_ci->m_fattr;
basic_info->Pad1 = 0;
rsp->OutputBufferLength =
- cpu_to_le32(offsetof(struct smb2_file_all_info, AllocationSize));
- inc_rfc1001_len(rsp_org, offsetof(struct smb2_file_all_info,
- AllocationSize));
+ cpu_to_le32(sizeof(struct smb2_file_basic_info));
+ inc_rfc1001_len(rsp_org, sizeof(struct smb2_file_basic_info));
return 0;
}
@@ -5412,7 +5411,7 @@ static int smb2_create_link(struct ksmbd_work *work,
static int set_file_basic_info(struct ksmbd_file *fp, char *buf,
struct ksmbd_share_config *share)
{
- struct smb2_file_all_info *file_info;
+ struct smb2_file_basic_info *file_info;
struct iattr attrs;
struct timespec64 ctime;
struct file *filp;
@@ -5423,7 +5422,7 @@ static int set_file_basic_info(struct ksmbd_file *fp, char *buf,
if (!(fp->daccess & FILE_WRITE_ATTRIBUTES_LE))
return -EACCES;
- file_info = (struct smb2_file_all_info *)buf;
+ file_info = (struct smb2_file_basic_info *)buf;
attrs.ia_valid = 0;
filp = fp->filp;
inode = file_inode(filp);
diff --git a/fs/ksmbd/smb2pdu.h b/fs/ksmbd/smb2pdu.h
index bcec845b03f3..261825d06391 100644
--- a/fs/ksmbd/smb2pdu.h
+++ b/fs/ksmbd/smb2pdu.h
@@ -1464,6 +1464,15 @@ struct smb2_file_all_info { /* data block encoding of response to level 18 */
char FileName[1];
} __packed; /* level 18 Query */
+struct smb2_file_basic_info { /* data block encoding of response to level 18 */
+ __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */
+ __le64 LastAccessTime;
+ __le64 LastWriteTime;
+ __le64 ChangeTime;
+ __le32 Attributes;
+ __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */
+} __packed;
+
struct smb2_file_alt_name_info {
__le32 FileNameLength;
char FileName[0];
--
2.25.1
next prev parent reply other threads:[~2021-09-29 8:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 8:44 [PATCH v4 0/9] ksmbd: a bunch of patches that is being reviewed Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 1/9] ksmbd: add the check to vaildate if stream protocol length exceeds maximum value Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 2/9] ksmbd: add validation in smb2_ioctl Namjae Jeon
2021-09-29 8:44 ` Namjae Jeon [this message]
2021-09-29 8:44 ` [PATCH v4 4/9] ksmbd: add request buffer validation in smb2_set_info Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 5/9] ksmbd: check strictly data area in ksmbd_smb2_check_message() Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 6/9] ksmbd: add validation in smb2 negotiate Namjae Jeon
2021-09-29 8:44 ` [PATCH v4 7/9] ksmbd: add buffer validation for SMB2_CREATE_CONTEXT Namjae Jeon
2021-09-29 8:45 ` [PATCH v4 8/9] ksmbd: remove the leftover of smb2.0 dialect support Namjae Jeon
2021-09-29 8:45 ` [PATCH v4 9/9] ksmbd: remove NTLMv1 authentication Namjae Jeon
2021-09-29 17:55 ` [PATCH v4 0/9] ksmbd: a bunch of patches that is being reviewed Ralph Boehme
2021-09-30 1:01 ` Namjae Jeon
2021-09-30 12:53 ` Ralph Boehme
2021-09-30 13:17 ` Namjae Jeon
2021-09-30 13:33 ` Ralph Boehme
2021-10-01 1:10 ` Namjae Jeon
2021-10-01 11:59 ` Ralph Boehme
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210929084501.94846-4-linkinjeon@kernel.org \
--to=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=slow@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox