diff options
author | Sarah Bailey <saharabeara@gmail.com> | 2007-02-23 01:36:21 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-23 18:03:46 -0500 |
commit | 50f97a1f829d26e01ae8bb33cd1384cf0a5e046f (patch) | |
tree | eee3da686667a2e532281622ec85d0eaacbcfbe2 /drivers/usb/gadget | |
parent | 4ef2e23f03c597e2073b649e7287b840f8fb9274 (diff) |
gadgetfs: Fixed bug in ep_aio_read_retry.
I don't think the current code works with multiple iovecs.
The original would just copy the first part of priv->buf
over and over into multiple iovecs.
Signed-off-by: Sarah Bailey <saharabeara@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/inode.c | 5 |
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 | } |