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 <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Kevin McKinney 2011-12-01 22:02:15 -05:00 committed by Greg Kroah-Hartman
parent 4c6fb5fc05
commit 09468b0392

View file

@ -1336,7 +1336,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if (copy_to_user(stNVMReadWrite.pBuffer, pReadData, stNVMReadWrite.uiNumBytes)) { if (copy_to_user(stNVMReadWrite.pBuffer, pReadData, stNVMReadWrite.uiNumBytes)) {
kfree(pReadData); kfree(pReadData);
Status = -EFAULT; return -EFAULT;
} }
} else { } else {
down(&Adapter->NVMRdmWrmLock); down(&Adapter->NVMRdmWrmLock);