USB: gadget: mtp: Fix OUT endpoint request length usage in read
DWC3 UDC requires OUT endpoint request length to be multiple of endpoint max packet size. Hence the OUT endpoint request is always set to the request buffer size in mtp read. The buffer can be allocated dynamically and is always multiple of 1024. If the count passed to read system call is less than the buffer size, we end up reading more bytes and not giving it to userspace. Userspace calls read with 512 bytes for receiving request from the host. If the request is for receiving a file, the read is called with 16K bytes for reading the header and some data. The remaining data is received via ioctl. If 1MB is used as request length for 16K read, the received file will be corrupted. Change-Id: I2eedf829f267150ff7a303824e95963219a1f555 Signed-off-by:Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by:
Hemant Kumar <hemantk@codeaurora.org>
Loading
Please register or sign in to comment