staging: wilc1000: fix freeing of ERR_PTR
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Fri, 4 Sep 2015 10:04:15 +0000 (15:34 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2015 01:24:43 +0000 (18:24 -0700)
If memdup_user() fails then it will return the error code in ERR_PTR. We
were checking it with IS_ERR but then again trying to free it on the
error path.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c

index c90c45907422db74031463cf2e42d551dd5c8424..020ed038130fa936af227a8f228e17b182aab405 100644 (file)
@@ -2116,10 +2116,8 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
                if (size && wrq->u.data.pointer) {
 
                        buff = memdup_user(wrq->u.data.pointer, wrq->u.data.length);
-                       if (IS_ERR(buff)) {
-                               s32Error = PTR_ERR(buff);
-                               goto done;
-                       }
+                       if (IS_ERR(buff))
+                               return PTR_ERR(buff);
 
                        if (strncasecmp(buff, "RSSI", length) == 0) {