From: Wim de With <nauxuron@wimdewith.com>
To: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: gdm72xx: add userspace data struct
Date: Fri, 11 Dec 2015 00:47:38 +0100 [thread overview]
Message-ID: <20151210234738.GA28422@boole.wimdewith.com> (raw)
In-Reply-To: <20151210144445.669ea27a@lxorguk.ukuu.org.uk>
On Thu, Dec 10, 2015 at 02:44:45PM +0000, One Thousand Gnomes wrote:
> (except that you mean sizeof(struct fsm_s) and it doesn't compile at the
> moment!
Oops, sloppy mistake.
> data_s can just be modified to be __user. All uses of it follow that
> rule.
What do you mean? The data still needs to be copied from user space to kernel
space, if I'm not mistaken. And not all uses follow that rule, since in both
gdm_wimax_ioctl_get_data() and gdm_wimax_ioctl_set_data() it is used as both
the source and destination in the copy_from_user() and copy_to_user() call.
> All I think you need in this case is
>
> struct fsm_s fsm_buf;
>
> if (copy_from_user(&fsm_buf, req->data.buf,sizeof(buf))
> return -EFAULT
> gdm_update_fsm(&fsm_buf);
Do you mean sizeof(fsm_s)? I realize this would have been far simpler than my
overkill solution.
> If you are touching the structs it might be wise to fix the other
> problems with them notably the use of int. sizes when used are unsigned -
> and signed sizes are asking for errors. In fact if you look at the
> existing uses of the size checks they look deeply suspicious the moment
> anything malicious passes in negative numbers.
I would love to do that, but it is a bit outside the scope of this patch, so I
would rather safe this for another patch.
next prev parent reply other threads:[~2015-12-10 23:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-10 9:11 [PATCH] " Wim de With
2015-12-10 9:37 ` Dan Carpenter
2015-12-10 9:42 ` Wim de With
2015-12-10 11:34 ` Dan Carpenter
2015-12-10 11:40 ` [PATCH v2] " Wim de With
2015-12-10 14:44 ` One Thousand Gnomes
2015-12-10 23:47 ` Wim de With [this message]
2015-12-11 0:17 ` One Thousand Gnomes
2015-12-11 9:25 ` [PATCH v3] " Wim de With
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=20151210234738.GA28422@boole.wimdewith.com \
--to=nauxuron@wimdewith.com \
--cc=devel@driverdev.osuosl.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome