Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1288411

Re: [PATCH] staging: gdm72xx: add userspace data struct

From Wim de With <nauxuron@wimdewith.com>
Newsgroups linux.kernel
Subject Re: [PATCH] staging: gdm72xx: add userspace data struct
Date 2015-12-10 11:00 +0100
Message-ID <qE6b0-4tx-15@gated-at.bofh.it> (permalink)
References <qE5yi-4b1-19@gated-at.bofh.it> <qE5RE-4kX-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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?

Wim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] staging: gdm72xx: add userspace data struct Wim de With <nauxuron@wimdewith.com> - 2015-12-10 10:20 +0100
  Re: [PATCH] staging: gdm72xx: add userspace data struct Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-10 10:40 +0100
    Re: [PATCH] staging: gdm72xx: add userspace data struct Wim de With <nauxuron@wimdewith.com> - 2015-12-10 11:00 +0100
      Re: [PATCH] staging: gdm72xx: add userspace data struct Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-10 12:40 +0100
        [PATCH v2] staging: gdm72xx: add userspace data struct Wim de With <nauxuron@wimdewith.com> - 2015-12-10 12:50 +0100
          Re: [PATCH v2] staging: gdm72xx: add userspace data struct One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2015-12-10 15:50 +0100
            Re: [PATCH v2] staging: gdm72xx: add userspace data struct Wim de With <nauxuron@wimdewith.com> - 2015-12-11 00:50 +0100
              Re: [PATCH v2] staging: gdm72xx: add userspace data struct One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2015-12-11 01:20 +0100
                [PATCH v3] staging: gdm72xx: add userspace data struct Wim de With <nauxuron@wimdewith.com> - 2015-12-11 10:30 +0100

csiph-web