]> Pileus Git - ~andy/linux/commitdiff
Staging: bcm: Fix double free of 'pReadData' in IOCTL_BCM_NVM_WRITE.
authorKevin McKinney <klmckinney1@gmail.com>
Fri, 2 Dec 2011 03:02:15 +0000 (22:02 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 8 Dec 2011 20:42:15 +0000 (12:42 -0800)
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 <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/bcm/Bcmchar.c

index 72a699c127040371f134b45db3eba0ed48c38906..ad1cc5598dca971d38a7c08fb4e080a3a6e2b3ee 100644 (file)
@@ -1336,7 +1336,7 @@ cntrlEnd:
 
                        if (copy_to_user(stNVMReadWrite.pBuffer, pReadData, stNVMReadWrite.uiNumBytes)) {
                                kfree(pReadData);
-                               Status = -EFAULT;
+                               return -EFAULT;
                        }
                } else {
                        down(&Adapter->NVMRdmWrmLock);