From 09468b0392b1d2b079b334d60a23d7da8105dc53 Mon Sep 17 00:00:00 2001 From: Kevin McKinney Date: Thu, 1 Dec 2011 22:02:15 -0500 Subject: [PATCH] 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 --- drivers/staging/bcm/Bcmchar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.39.5