Skip to content

Commit

Permalink
Staging: bcm: Fix double free of 'pReadData' in IOCTL_BCM_NVM_WRITE.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kevin McKinney authored and Greg Kroah-Hartman committed Dec 8, 2011
1 parent 4c6fb5f commit 09468b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/bcm/Bcmchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
kfree(pReadData);
Status = -EFAULT;
return -EFAULT;
}
} else {
down(&Adapter->NVMRdmWrmLock);
Expand Down

0 comments on commit 09468b0

Please sign in to comment.