* [PATCH 1/2] ksmbd: downgrade addition info error msg to debug in smb2_get_info_sec()
@ 2021-11-21 11:43 Namjae Jeon
2021-11-21 11:43 ` [PATCH 2/2] ksmbd: contain default data stream even if xattr is empty Namjae Jeon
2021-11-23 0:18 ` [PATCH 1/2] ksmbd: downgrade addition info error msg to debug in smb2_get_info_sec() Hyunchul Lee
0 siblings, 2 replies; 4+ messages in thread
From: Namjae Jeon @ 2021-11-21 11:43 UTC (permalink / raw)
To: linux-cifs; +Cc: Namjae Jeon, stable
While file transfer through windows client, This error flood message
happen. This flood message will cause performance degradation and
misunderstand server has problem.
Fixes: e294f78d3478 ("ksmbd: allow PROTECTED_DACL_SECINFO and UNPROTECTED_DACL_SECINFO addition information in smb2 set info security")
Cc: stable@vger.kernel.org # v5.15
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
fs/ksmbd/smb2pdu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 121f8e8c70ac..82954b2b8d31 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -5068,7 +5068,7 @@ static int smb2_get_info_sec(struct ksmbd_work *work,
if (addition_info & ~(OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO |
PROTECTED_DACL_SECINFO |
UNPROTECTED_DACL_SECINFO)) {
- pr_err("Unsupported addition info: 0x%x)\n",
+ ksmbd_debug(SMB, "Unsupported addition info: 0x%x)\n",
addition_info);
pntsd->revision = cpu_to_le16(1);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ksmbd: contain default data stream even if xattr is empty
2021-11-21 11:43 [PATCH 1/2] ksmbd: downgrade addition info error msg to debug in smb2_get_info_sec() Namjae Jeon
@ 2021-11-21 11:43 ` Namjae Jeon
2021-11-23 0:19 ` Hyunchul Lee
2021-11-23 0:18 ` [PATCH 1/2] ksmbd: downgrade addition info error msg to debug in smb2_get_info_sec() Hyunchul Lee
1 sibling, 1 reply; 4+ messages in thread
From: Namjae Jeon @ 2021-11-21 11:43 UTC (permalink / raw)
To: linux-cifs; +Cc: Namjae Jeon, stable
If xattr is not supported like exfat or fat, ksmbd server doesn't
contain default data stream in FILE_STREAM_INFORMATION response. It will
cause ppt or doc file update issue if local filesystem is such as ones.
This patch move goto statement to contain it.
Fixes: 9f6323311c70 ("ksmbd: add default data stream name in FILE_STREAM_INFORMATION")
Cc: stable@vger.kernel.org # v5.15
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
fs/ksmbd/smb2pdu.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 82954b2b8d31..2067d5bab1b0 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -4457,6 +4457,12 @@ static void get_file_stream_info(struct ksmbd_work *work,
&stat);
file_info = (struct smb2_file_stream_info *)rsp->Buffer;
+ buf_free_len =
+ smb2_calc_max_out_buf_len(work, 8,
+ le32_to_cpu(req->OutputBufferLength));
+ if (buf_free_len < 0)
+ goto out;
+
xattr_list_len = ksmbd_vfs_listxattr(path->dentry, &xattr_list);
if (xattr_list_len < 0) {
goto out;
@@ -4465,12 +4471,6 @@ static void get_file_stream_info(struct ksmbd_work *work,
goto out;
}
- buf_free_len =
- smb2_calc_max_out_buf_len(work, 8,
- le32_to_cpu(req->OutputBufferLength));
- if (buf_free_len < 0)
- goto out;
-
while (idx < xattr_list_len) {
stream_name = xattr_list + idx;
streamlen = strlen(stream_name);
@@ -4514,6 +4514,7 @@ static void get_file_stream_info(struct ksmbd_work *work,
file_info->NextEntryOffset = cpu_to_le32(next);
}
+out:
if (!S_ISDIR(stat.mode) &&
buf_free_len >= sizeof(struct smb2_file_stream_info) + 7 * 2) {
file_info = (struct smb2_file_stream_info *)
@@ -4522,14 +4523,13 @@ static void get_file_stream_info(struct ksmbd_work *work,
"::$DATA", 7, conn->local_nls, 0);
streamlen *= 2;
file_info->StreamNameLength = cpu_to_le32(streamlen);
- file_info->StreamSize = 0;
- file_info->StreamAllocationSize = 0;
+ file_info->StreamSize = cpu_to_le64(stat.size);
+ file_info->StreamAllocationSize = cpu_to_le64(stat.blocks << 9);
nbytes += sizeof(struct smb2_file_stream_info) + streamlen;
}
/* last entry offset should be 0 */
file_info->NextEntryOffset = 0;
-out:
kvfree(xattr_list);
rsp->OutputBufferLength = cpu_to_le32(nbytes);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ksmbd: downgrade addition info error msg to debug in smb2_get_info_sec()
2021-11-21 11:43 [PATCH 1/2] ksmbd: downgrade addition info error msg to debug in smb2_get_info_sec() Namjae Jeon
2021-11-21 11:43 ` [PATCH 2/2] ksmbd: contain default data stream even if xattr is empty Namjae Jeon
@ 2021-11-23 0:18 ` Hyunchul Lee
1 sibling, 0 replies; 4+ messages in thread
From: Hyunchul Lee @ 2021-11-23 0:18 UTC (permalink / raw)
To: Namjae Jeon; +Cc: linux-cifs, stable
Acked-by: Hyunchul Lee <hyc.lee@gmail.com>
2021년 11월 21일 (일) 오후 9:33, Namjae Jeon <linkinjeon@kernel.org>님이 작성:
>
> While file transfer through windows client, This error flood message
> happen. This flood message will cause performance degradation and
> misunderstand server has problem.
>
> Fixes: e294f78d3478 ("ksmbd: allow PROTECTED_DACL_SECINFO and UNPROTECTED_DACL_SECINFO addition information in smb2 set info security")
> Cc: stable@vger.kernel.org # v5.15
> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> ---
> fs/ksmbd/smb2pdu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
> index 121f8e8c70ac..82954b2b8d31 100644
> --- a/fs/ksmbd/smb2pdu.c
> +++ b/fs/ksmbd/smb2pdu.c
> @@ -5068,7 +5068,7 @@ static int smb2_get_info_sec(struct ksmbd_work *work,
> if (addition_info & ~(OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO |
> PROTECTED_DACL_SECINFO |
> UNPROTECTED_DACL_SECINFO)) {
> - pr_err("Unsupported addition info: 0x%x)\n",
> + ksmbd_debug(SMB, "Unsupported addition info: 0x%x)\n",
> addition_info);
>
> pntsd->revision = cpu_to_le16(1);
> --
> 2.25.1
>
--
Thanks,
Hyunchul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ksmbd: contain default data stream even if xattr is empty
2021-11-21 11:43 ` [PATCH 2/2] ksmbd: contain default data stream even if xattr is empty Namjae Jeon
@ 2021-11-23 0:19 ` Hyunchul Lee
0 siblings, 0 replies; 4+ messages in thread
From: Hyunchul Lee @ 2021-11-23 0:19 UTC (permalink / raw)
To: Namjae Jeon; +Cc: linux-cifs, stable
Acked-by: Hyunchul Lee <hyc.lee@gmail.com>
2021년 11월 21일 (일) 오후 9:33, Namjae Jeon <linkinjeon@kernel.org>님이 작성:
>
> If xattr is not supported like exfat or fat, ksmbd server doesn't
> contain default data stream in FILE_STREAM_INFORMATION response. It will
> cause ppt or doc file update issue if local filesystem is such as ones.
> This patch move goto statement to contain it.
>
> Fixes: 9f6323311c70 ("ksmbd: add default data stream name in FILE_STREAM_INFORMATION")
> Cc: stable@vger.kernel.org # v5.15
> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> ---
> fs/ksmbd/smb2pdu.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
> index 82954b2b8d31..2067d5bab1b0 100644
> --- a/fs/ksmbd/smb2pdu.c
> +++ b/fs/ksmbd/smb2pdu.c
> @@ -4457,6 +4457,12 @@ static void get_file_stream_info(struct ksmbd_work *work,
> &stat);
> file_info = (struct smb2_file_stream_info *)rsp->Buffer;
>
> + buf_free_len =
> + smb2_calc_max_out_buf_len(work, 8,
> + le32_to_cpu(req->OutputBufferLength));
> + if (buf_free_len < 0)
> + goto out;
> +
> xattr_list_len = ksmbd_vfs_listxattr(path->dentry, &xattr_list);
> if (xattr_list_len < 0) {
> goto out;
> @@ -4465,12 +4471,6 @@ static void get_file_stream_info(struct ksmbd_work *work,
> goto out;
> }
>
> - buf_free_len =
> - smb2_calc_max_out_buf_len(work, 8,
> - le32_to_cpu(req->OutputBufferLength));
> - if (buf_free_len < 0)
> - goto out;
> -
> while (idx < xattr_list_len) {
> stream_name = xattr_list + idx;
> streamlen = strlen(stream_name);
> @@ -4514,6 +4514,7 @@ static void get_file_stream_info(struct ksmbd_work *work,
> file_info->NextEntryOffset = cpu_to_le32(next);
> }
>
> +out:
> if (!S_ISDIR(stat.mode) &&
> buf_free_len >= sizeof(struct smb2_file_stream_info) + 7 * 2) {
> file_info = (struct smb2_file_stream_info *)
> @@ -4522,14 +4523,13 @@ static void get_file_stream_info(struct ksmbd_work *work,
> "::$DATA", 7, conn->local_nls, 0);
> streamlen *= 2;
> file_info->StreamNameLength = cpu_to_le32(streamlen);
> - file_info->StreamSize = 0;
> - file_info->StreamAllocationSize = 0;
> + file_info->StreamSize = cpu_to_le64(stat.size);
> + file_info->StreamAllocationSize = cpu_to_le64(stat.blocks << 9);
> nbytes += sizeof(struct smb2_file_stream_info) + streamlen;
> }
>
> /* last entry offset should be 0 */
> file_info->NextEntryOffset = 0;
> -out:
> kvfree(xattr_list);
>
> rsp->OutputBufferLength = cpu_to_le32(nbytes);
> --
> 2.25.1
>
--
Thanks,
Hyunchul
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-23 0:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-21 11:43 [PATCH 1/2] ksmbd: downgrade addition info error msg to debug in smb2_get_info_sec() Namjae Jeon
2021-11-21 11:43 ` [PATCH 2/2] ksmbd: contain default data stream even if xattr is empty Namjae Jeon
2021-11-23 0:19 ` Hyunchul Lee
2021-11-23 0:18 ` [PATCH 1/2] ksmbd: downgrade addition info error msg to debug in smb2_get_info_sec() Hyunchul Lee
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).