From: Kevin McKinney Date: Fri, 2 Dec 2011 03:02:15 +0000 (-0500) Subject: Staging: bcm: Fix double free of 'pReadData' in IOCTL_BCM_NVM_WRITE. X-Git-Tag: next-20111209~13^2~19 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=09468b0392b1d2b079b334d60a23d7da8105dc53;p=karo-tx-linux.git Staging: bcm: Fix double free of 'pReadData' in IOCTL_BCM_NVM_WRITE. This patch fixes a memory error in ioctl, IOCTL_BCM_NVM_WRITE. While copying data to user space, if an error occurs, pReadData is freed. Then, at the end of the ioctl, pReadData was being freed again. Signed-off-by: Kevin McKinney Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 72a699c12704..ad1cc5598dca 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -1336,7 +1336,7 @@ cntrlEnd: if (copy_to_user(stNVMReadWrite.pBuffer, pReadData, stNVMReadWrite.uiNumBytes)) { kfree(pReadData); - Status = -EFAULT; + return -EFAULT; } } else { down(&Adapter->NVMRdmWrmLock);