aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/inode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 34296e79edcf..188c74a95216 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -553,6 +553,7 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)
553{ 553{
554 struct kiocb_priv *priv = iocb->private; 554 struct kiocb_priv *priv = iocb->private;
555 ssize_t len, total; 555 ssize_t len, total;
556 void *to_copy;
556 int i; 557 int i;
557 558
558 /* we "retry" to get the right mm context for this: */ 559 /* we "retry" to get the right mm context for this: */
@@ -560,10 +561,11 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)
560 /* copy stuff into user buffers */ 561 /* copy stuff into user buffers */
561 total = priv->actual; 562 total = priv->actual;
562 len = 0; 563 len = 0;
564 to_copy = priv->buf;
563 for (i=0; i < priv->nr_segs; i++) { 565 for (i=0; i < priv->nr_segs; i++) {
564 ssize_t this = min((ssize_t)(priv->iv[i].iov_len), total); 566 ssize_t this = min((ssize_t)(priv->iv[i].iov_len), total);
565 567
566 if (copy_to_user(priv->iv[i].iov_base, priv->buf, this)) { 568 if (copy_to_user(priv->iv[i].iov_base, to_copy, this)) {
567 if (len == 0) 569 if (len == 0)
568 len = -EFAULT; 570 len = -EFAULT;
569 break; 571 break;
@@ -571,6 +573,7 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)
571 573
572 total -= this; 574 total -= this;
573 len += this; 575 len += this;
576 to_copy += this;
574 if (total == 0) 577 if (total == 0)
575 break; 578 break;
576 } 579 }