From: Krzysztof Opasiak <k.opasiak@samsung.com>
To: Michal Nazarewicz <mina86@mina86.com>,
"Du, Changbin" <changbin.du@intel.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
Alan Stern <stern@rowland.harvard.edu>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"rui.silva@linaro.org" <rui.silva@linaro.org>,
"lars@metafoo.de" <lars@metafoo.de>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: gadget: f_fs: report error if excess data received
Date: Mon, 16 May 2016 18:35:12 +0200 [thread overview]
Message-ID: <5739F6C0.1000202@samsung.com> (raw)
In-Reply-To: <xa1td1omf0od.fsf@mina86.com>
Hi Michal,
On 05/16/2016 06:05 PM, Michal Nazarewicz wrote:
> So I’ve been looking at AIO handling in f_fs and either I’m stupid or
> the code is broken. Here’s part of ffs_user_copy_worker:
>
> int ret = io_data->req->status ? io_data->req->status :
> io_data->req->actual;
> if (io_data->read && ret > 0) {
> use_mm(io_data->mm);
> ret = copy_to_iter(io_data->buf, ret, &io_data->data);
> if (iov_iter_count(&io_data->data))
> ret = -EFAULT;
> unuse_mm(io_data->mm);
> }
>
> First of all, shouldn’t the copy_to_iter invocation be:
>
> if (copy_to_iter(io_data->buf, ret, &io_data->data))
> ret = -EFAULT;
>
> Second of all, if the request reads fewer bytes than user requested,
> iov_iter_count(…) will be non-zero (namely it will be the difference
> between user’s buffer size and data read). This should not result in
> EFAULT though.
>
> So, am I going crazy? Or does this need to be fixed as well?
>
I think it has been already fixed:
http://permalink.gmane.org/gmane.linux.usb.general/139316
Cheers,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
prev parent reply other threads:[~2016-05-16 16:35 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-11 10:19 [PATCH] usb: gadget: f_fs: report error if excess data received changbin.du
2016-05-11 10:59 ` Felipe Balbi
2016-05-11 12:30 ` Michal Nazarewicz
2016-05-12 4:25 ` Du, Changbin
2016-05-12 4:21 ` Du, Changbin
2016-05-12 6:52 ` Felipe Balbi
2016-05-12 7:30 ` Du, Changbin
2016-05-12 7:46 ` Felipe Balbi
2016-05-12 8:16 ` Du, Changbin
2016-05-12 9:15 ` Felipe Balbi
2016-05-12 9:22 ` Felipe Balbi
2016-05-12 9:51 ` Du, Changbin
2016-05-12 9:39 ` Du, Changbin
2016-05-12 10:13 ` Felipe Balbi
2016-05-12 10:14 ` Felipe Balbi
2016-05-12 10:45 ` Du, Changbin
2016-05-12 11:22 ` Felipe Balbi
2016-05-13 5:52 ` Du, Changbin
2016-05-13 6:36 ` Felipe Balbi
2016-05-13 10:32 ` Du, Changbin
2016-05-13 14:29 ` Alan Stern
2016-05-14 20:39 ` Michal Nazarewicz
2016-05-16 12:57 ` Felipe Balbi
2016-05-16 13:08 ` Michal Nazarewicz
2016-05-16 13:16 ` Felipe Balbi
2016-05-16 19:09 ` Michal Nazarewicz
2016-05-17 2:53 ` Du, Changbin
2016-05-18 9:45 ` Michal Nazarewicz
2016-05-18 10:15 ` Felipe Balbi
2016-05-18 13:39 ` Michal Nazarewicz
2016-05-19 2:54 ` Du, Changbin
2016-05-19 7:34 ` Michal Nazarewicz
2016-05-19 8:49 ` Du, Changbin
2016-05-19 2:31 ` Du, Changbin
2016-05-16 16:05 ` Michal Nazarewicz
2016-05-16 16:27 ` Lars-Peter Clausen
2016-05-16 16:48 ` Michal Nazarewicz
2016-05-16 16:35 ` Krzysztof Opasiak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5739F6C0.1000202@samsung.com \
--to=k.opasiak@samsung.com \
--cc=changbin.du@intel.com \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mina86@mina86.com \
--cc=rui.silva@linaro.org \
--cc=stern@rowland.harvard.edu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).