Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09468b03 authored by Kevin McKinney's avatar Kevin McKinney Committed by Greg Kroah-Hartman
Browse files

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: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4c6fb5fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);