summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongwoo Lee <dwoo08.lee@samsung.com>2023-08-21 20:25:43 +0900
committerDongwoo Lee <dwoo08.lee@samsung.com>2023-08-21 20:34:25 +0900
commit907f728394677d0ef794df34f4d52170f6a3adeb (patch)
tree21fd2f29d4fb3dd85295ed9137337e1ec081d5d1
parent3bfec121f53962e327b501b80b32213bbf3c22eb (diff)
downloadlinux-starfive-907f728394677d0ef794df34f4d52170f6a3adeb.tar.gz
linux-starfive-907f728394677d0ef794df34f4d52170f6a3adeb.tar.bz2
linux-starfive-907f728394677d0ef794df34f4d52170f6a3adeb.zip
usb: gadget: f_fs: Limit the maximum length of data transferringaccepted/tizen/unified/riscv/20230822.054229
When the ffs daemons request transfer with large size buffer, the usb subsystems below cannot filled the buffer at once and then the request is stalled in f_fs_epfile_io function. In order to prevent this situation, this limits maximum length of data as PAGE_SIZE. Change-Id: Ib84b3493a56b21f33a07cf0533f8df71580b7540 Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
-rw-r--r--drivers/usb/gadget/function/f_fs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 3e59055aa504..c6a52e7424fd 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1013,6 +1013,8 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
goto error_lock;
}
data_len = iov_iter_count(&io_data->data);
+ data_len = data_len > PAGE_SIZE ? PAGE_SIZE : data_len;
+
/*
* Controller may require buffer size to be aligned to
* maxpacketsize of an out endpoint.