staging: rtl8712: check copy_from_user return value
authorXiaochen Wang <wangxiaochen0@gmail.com>
Sun, 6 Mar 2011 14:24:14 +0000 (22:24 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 7 Mar 2011 21:46:38 +0000 (13:46 -0800)
Description:return -EFAULT if copy_to_user() fails

Signed-off-by: Xiaochen Wang <wangxiaochen0@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8712/rtl871x_ioctl_linux.c

index 221be81c85eb846497308b86f510100e00d9158a..4ac17c0bbd59dd1af2912c4588efde68c30bdc1d 100644 (file)
@@ -1970,9 +1970,9 @@ static int r871x_wps_start(struct net_device *dev,
        struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);
        struct iw_point *pdata = &wrqu->data;
        u32   u32wps_start = 0;
-       unsigned int uintRet = 0;
 
-       uintRet = copy_from_user((void *)&u32wps_start, pdata->pointer, 4);
+       if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4))
+               return -EFAULT;
        if ((padapter->bDriverStopped) || (pdata == NULL))
                return -EINVAL;
        if (u32wps_start == 0)