From: Cristian Stoica <cristian.sto...@freescale.com>

This is the correct memleak fix as intended by
50e714aeff2d6fb4c9d5793a706abb330aa073fc. The original fix does not
address deallocation problems when kzalloc(pcr) fails.

Signed-off-by: Cristian Stoica <cristian.sto...@freescale.com>
Signed-off-by: Horia Geanta <horia.gea...@freescale.com>
---
 ioctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ioctl.c b/ioctl.c
index 999fb31..7a69e5a 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -453,9 +453,9 @@ cryptodev_open(struct inode *inode, struct file *filp)
        int i;
 
        pcr = kzalloc(sizeof(*pcr), GFP_KERNEL);
+       filp->private_data = pcr;
        if (!pcr)
                return -ENOMEM;
-       filp->private_data = pcr;
 
        mutex_init(&pcr->fcrypt.sem);
        mutex_init(&pcr->free.lock);
-- 
1.7.7.6



_______________________________________________
Cryptodev-linux-devel mailing list
Cryptodev-linux-devel@gna.org
https://mail.gna.org/listinfo/cryptodev-linux-devel

Reply via email to