From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Vasiliy Kulikov <segooon@gmail.com>
Cc: kernel-janitors@vger.kernel.org,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
linux-kernel@vger.kernel.org, xen-devel@lists.xen.org,
virtualization@lists.osdl.org
Subject: Re: [PATCH] xen: xenfs: privcmd: check put_user() return code
Date: Fri, 29 Oct 2010 17:18:01 +0000 [thread overview]
Message-ID: <4CCB01C9.4020007@goop.org> (raw)
In-Reply-To: <1288265942-12581-1-git-send-email-segooon@gmail.com>
On 10/28/2010 04:39 AM, Vasiliy Kulikov wrote:
> put_user() may fail. In this case propagate error code from
> privcmd_ioctl_mmap_batch().
Thanks for looking at this. I'm in two minds about this; the existing
logic is such that these put_users can only fail if something else has
already failed and its returning an error. I guess it would be useful
to get an EFAULT if you've got a problem writing back the results.
IanC, any opinion?
Thanks,
J
> Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> ---
> Compile tested.
>
> drivers/xen/xenfs/privcmd.c | 8 ++------
> 1 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/xen/xenfs/privcmd.c b/drivers/xen/xenfs/privcmd.c
> index f80be7f..2eb04c8 100644
> --- a/drivers/xen/xenfs/privcmd.c
> +++ b/drivers/xen/xenfs/privcmd.c
> @@ -266,9 +266,7 @@ static int mmap_return_errors(void *data, void *state)
> xen_pfn_t *mfnp = data;
> struct mmap_batch_state *st = state;
>
> - put_user(*mfnp, st->user++);
> -
> - return 0;
> + return put_user(*mfnp, st->user++);
> }
>
> static struct vm_operations_struct privcmd_vm_ops;
> @@ -323,10 +321,8 @@ static long privcmd_ioctl_mmap_batch(void __user *udata)
> up_write(&mm->mmap_sem);
>
> if (state.err > 0) {
> - ret = 0;
> -
> state.user = m.arr;
> - traverse_pages(m.num, sizeof(xen_pfn_t),
> + ret = traverse_pages(m.num, sizeof(xen_pfn_t),
> &pagelist,
> mmap_return_errors, &state);
> }
next prev parent reply other threads:[~2010-10-29 17:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 11:39 [PATCH] xen: xenfs: privcmd: check put_user() return code Vasiliy Kulikov
2010-10-29 17:18 ` Jeremy Fitzhardinge [this message]
2010-10-29 17:44 ` Ian Campbell
2010-10-29 17:52 ` Jeremy Fitzhardinge
2010-10-29 17:57 ` Ian Campbell
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=4CCB01C9.4020007@goop.org \
--to=jeremy@goop.org \
--cc=ian.campbell@citrix.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=segooon@gmail.com \
--cc=virtualization@lists.osdl.org \
--cc=xen-devel@lists.xen.org \
/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