If one of kzalloc(todo_list_item) fail, filp->private_data remains garbage and cryptodev_release will fail during free. To fix that, filp->private_data is set early so that at release, there will be knowledge about allocated memory.
Signed-off-by: Cristian Stoica <cristian.sto...@freescale.com> --- ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ioctl.c b/ioctl.c index e918e8d..53f2719 100644 --- a/ioctl.c +++ b/ioctl.c @@ -454,6 +454,7 @@ cryptodev_open(struct inode *inode, struct file *filp) pcr = kzalloc(sizeof(*pcr), GFP_KERNEL); if (!pcr) return -ENOMEM; + filp->private_data = pcr; mutex_init(&pcr->fcrypt.sem); INIT_LIST_HEAD(&pcr->fcrypt.list); @@ -477,7 +478,6 @@ cryptodev_open(struct inode *inode, struct file *filp) list_add(&tmp->__hook, &pcr->free.list); } - filp->private_data = pcr; dprintk(2, KERN_DEBUG, "Cryptodev handle initialised, %d elements in queue\n", DEF_COP_RINGSIZE); -- 1.7.11.7 _______________________________________________ Cryptodev-linux-devel mailing list Cryptodev-linux-devel@gna.org https://mail.gna.org/listinfo/cryptodev-linux-devel