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 <[email protected]>
---
 drivers/staging/bcm/Bcmchar.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index 72a699c..ad1cc55 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);
-- 
1.7.4.1

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to