]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.0.8/usb-gadget-f_fs-fix-check-in-read-operation.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.0.8 / usb-gadget-f_fs-fix-check-in-read-operation.patch
1 From 342f39a6c8d34d638a87b7d5f2156adc4db2585c Mon Sep 17 00:00:00 2001
2 From: Rui Miguel Silva <rui.silva@linaro.org>
3 Date: Wed, 20 May 2015 14:53:33 +0100
4 Subject: usb: gadget: f_fs: fix check in read operation
5
6 From: Rui Miguel Silva <rui.silva@linaro.org>
7
8 commit 342f39a6c8d34d638a87b7d5f2156adc4db2585c upstream.
9
10 when copying to iter the size can be different then the iov count,
11 the check for full iov is wrong and make any read on request which
12 is not the exactly size of iov to return -EFAULT.
13
14 So, just check the success of the copy.
15
16 Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
17 Signed-off-by: Felipe Balbi <balbi@ti.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 drivers/usb/gadget/function/f_fs.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24 --- a/drivers/usb/gadget/function/f_fs.c
25 +++ b/drivers/usb/gadget/function/f_fs.c
26 @@ -845,7 +845,7 @@ static ssize_t ffs_epfile_io(struct file
27 ret = ep->status;
28 if (io_data->read && ret > 0) {
29 ret = copy_to_iter(data, ret, &io_data->data);
30 - if (unlikely(iov_iter_count(&io_data->data)))
31 + if (!ret)
32 ret = -EFAULT;
33 }
34 }