diff options
| author | Namjae Jeon <linkinjeon@kernel.org> | 2023-08-29 23:39:31 +0900 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2023-08-29 12:30:19 -0500 |
| commit | e2b76ab8b5c9327ab2dae6da05d0752eb2f4771d (patch) | |
| tree | 1764248441cf770e0202eb50c187dcfbbc2303f7 /fs/smb/server/auth.c | |
| parent | 084ba46fc41c21ba827fd92e61f78def7a6e52ea (diff) | |
| download | linux-e2b76ab8b5c9327ab2dae6da05d0752eb2f4771d.tar.gz linux-e2b76ab8b5c9327ab2dae6da05d0752eb2f4771d.tar.bz2 linux-e2b76ab8b5c9327ab2dae6da05d0752eb2f4771d.zip | |
ksmbd: add support for read compound
MacOS sends a compound request including read to the server
(e.g. open-read-close). So far, ksmbd has not handled read as
a compound request. For compatibility between ksmbd and an OS that
supports SMB, This patch provides compound support for read requests.
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/server/auth.c')
| -rw-r--r-- | fs/smb/server/auth.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/smb/server/auth.c b/fs/smb/server/auth.c index 5e5e120edcc2..af7b2cdba126 100644 --- a/fs/smb/server/auth.c +++ b/fs/smb/server/auth.c @@ -1029,11 +1029,15 @@ static struct scatterlist *ksmbd_init_sg(struct kvec *iov, unsigned int nvec, { struct scatterlist *sg; unsigned int assoc_data_len = sizeof(struct smb2_transform_hdr) - 20; - int i, nr_entries[3] = {0}, total_entries = 0, sg_idx = 0; + int i, *nr_entries, total_entries = 0, sg_idx = 0; if (!nvec) return NULL; + nr_entries = kcalloc(nvec, sizeof(int), GFP_KERNEL); + if (!nr_entries) + return NULL; + for (i = 0; i < nvec - 1; i++) { unsigned long kaddr = (unsigned long)iov[i + 1].iov_base; @@ -1051,8 +1055,10 @@ static struct scatterlist *ksmbd_init_sg(struct kvec *iov, unsigned int nvec, total_entries += 2; sg = kmalloc_array(total_entries, sizeof(struct scatterlist), GFP_KERNEL); - if (!sg) + if (!sg) { + kfree(nr_entries); return NULL; + } sg_init_table(sg, total_entries); smb2_sg_set_buf(&sg[sg_idx++], iov[0].iov_base + 24, assoc_data_len); @@ -1086,6 +1092,7 @@ static struct scatterlist *ksmbd_init_sg(struct kvec *iov, unsigned int nvec, } } smb2_sg_set_buf(&sg[sg_idx], sign, SMB2_SIGNATURE_SIZE); + kfree(nr_entries); return sg; } |
