Re: [CHECKER] 32 Memory Leaks on Error Paths

From: Chris Wright
Date: Fri Sep 19 2003 - 18:06:20 EST


* David Yu Chen (dychen@xxxxxxxxxxxx) wrote:
> [FILE: 2.6.0-test5/security/selinux/selinuxfs.c]
> START -->
> 253: ar = kmalloc(PAGE_SIZE, GFP_KERNEL);
> 254: if (!ar)
> 255: return -ENOMEM;
> 256: memset(ar, 0, PAGE_SIZE); /* clear buffer, particularly last byte */
> 257: ar->size = 0;
> 258: down(&file->f_dentry->d_inode->i_sem);
> ... DELETED 5 lines ...

A reference to ar is stored away for kfree() on ->release():
file->private_data = ar;

> 268: if (copy_from_user(ar->data, buf, size))
> END -->
> 269: return -EFAULT;

So, this will be freed when the file is closed. I don't think it's a
bug.

thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/