From: Wei Yongjun Date: Mon, 8 Oct 2012 00:43:45 +0000 (+0800) Subject: staging: r8712u: fix potential NULL pointer dereference in r871x_wps_start() X-Git-Tag: master-2012-12-14~44^2~1119 X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=605fba82a2d6f8e19b7530805b792487562429a7;p=~andy%2Flinux staging: r8712u: fix potential NULL pointer dereference in r871x_wps_start() The dereference should be moved below the NULL test. dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun Acked-by: Larry Finger Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index c9a6a7fbb89..3a647906451 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -2110,10 +2110,10 @@ static int r871x_wps_start(struct net_device *dev, struct iw_point *pdata = &wrqu->data; u32 u32wps_start = 0; - if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4)) - return -EFAULT; if ((padapter->bDriverStopped) || (pdata == NULL)) return -EINVAL; + if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4)) + return -EFAULT; if (u32wps_start == 0) u32wps_start = *extra; if (u32wps_start == 1) /* WPS Start */