summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/function
diff options
context:
space:
mode:
authorVijayavardhan Vennapusa <vvreddy@codeaurora.org>2015-12-24 17:02:22 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:22:02 -0700
commit0ede2f03b1158af120ec4cf0be914646bddd7e74 (patch)
tree844eac573583a2cc8559ee8b96b4a0b8cc6cf333 /drivers/usb/gadget/function
parent9c8cd50d9d7b2aea8a34625a020e1b9f071c5a53 (diff)
USB: gadget: f_mtp: Update header length correctly in send_file_work
Whenever data is transmitted from device to Host PC, MTP daemon sitting in userspace writes to mtp driver through ioctl, which eventually calls send_file_work to send data. Currently header length is not updated properly to reflect correct length in case data file size is greater than 4GB. Due to this, Host PC throws error when file of size > 4GB is copied from device to Host PC. Hence fix the issue by updating header length to (2 ^ 32 - 1) if length is greater than 4GB. CRs-Fixed: 953737 Change-Id: I3840afb63f365c28bf3638b13b728800bc2419f4 Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Diffstat (limited to 'drivers/usb/gadget/function')
-rw-r--r--drivers/usb/gadget/function/f_mtp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_mtp.c b/drivers/usb/gadget/function/f_mtp.c
index aec7b8d61fe7..dc157efd5fc3 100644
--- a/drivers/usb/gadget/function/f_mtp.c
+++ b/drivers/usb/gadget/function/f_mtp.c
@@ -705,7 +705,15 @@ static void send_file_work(struct work_struct *data)
if (hdr_size) {
/* prepend MTP data header */
header = (struct mtp_data_header *)req->buf;
- header->length = __cpu_to_le32(count);
+ /*
+ * Set length as 0xffffffff, if it is greater than
+ * 0xffffffff. Otherwise host will throw error, if file
+ * size greater than 0xffffffff being transferred.
+ */
+ if (count > 0xffffffffLL)
+ header->length = 0xffffffff;
+ else
+ header->length = __cpu_to_le32(count);
header->type = __cpu_to_le16(2); /* data packet */
header->command = __cpu_to_le16(dev->xfer_command);
header->transaction_id =