public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Wim de With <nauxuron@wimdewith.com>
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: gdm72xx: add userspace data struct
Date: Thu, 10 Dec 2015 14:34:21 +0300	[thread overview]
Message-ID: <20151210113421.GE5284@mwanda> (raw)
In-Reply-To: <566948F6.80904@wimdewith.com>

On Thu, Dec 10, 2015 at 10:42:14AM +0100, Wim de With wrote:
> On 10-12-2015 10:37, Dan Carpenter wrote:
> > On Thu, Dec 10, 2015 at 10:11:12AM +0100, Wim de With wrote:
> >> @@ -482,8 +483,16 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
> >>  				/* NOTE: gdm_update_fsm should be called
> >>  				 * before gdm_wimax_ioctl_set_data is called.
> >>  				 */
> >> -				gdm_update_fsm(dev,
> >> -					       req->data.buf);
> >> +				fsm_buf = kmalloc(sizeof(fsm_s), GFP_KERNEL);
> >> +				if (!fsm_buf)
> >> +					return -ENOMEM;
> >> +				if (copy_from_user(fsm_buf, req->data.buf,
> >> +						   sizeof(fsm_s))) {
> >> +					kfree(fsm_buf);
> >> +					return -EFAULT;
> >> +				}
> >> +				gdm_update_fsm(dev, fsm_buf);
> >> +				kfree(fsm_buf);
> > 
> > 
> > No.  This change is a bug.
> > 
> > regards,
> > dan carpenter
> > 
> 
> But what if I just keep it as:
> 
> 	gdm_update_fsm(dev, req->data.buf)
> 
> Then it would just trust a __user pointer right?

I appologize, I didn't read the patch carefully.  This is a bugfix.  Can
you resend the patch with a better patch description where you replace
the last paragraph and say:

Once I updated the Sparse annotations, I noticed a bug in
gdm_wimax_ioctl() where we pass a user space pointer to gdm_update_fsm()
which dereferences it.  I fixed this.

regards,
dan carpenter

  reply	other threads:[~2015-12-10 11:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10  9:11 [PATCH] staging: gdm72xx: add userspace data struct 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 [this message]
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
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=20151210113421.GE5284@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nauxuron@wimdewith.com \
    /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