[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: [patch] inotify: a replacement for dnotify
From:       Chris Wright <chrisw () osdl ! org>
Date:       2004-11-30 23:03:45
Message-ID: 20041130150345.K14339 () build ! pdx ! osdl ! net
[Download RAW message or body]

* Robert Love (rml@novell.com) wrote:
> +	user = find_user(current->user->uid);
> +	if (!user)
> +		return -ENOMEM;

Can just be:

	get_uid(current->user);

> +
> +	if (atomic_read(&user->inotify_devs) >= sysfs_attrib_max_user_devices)
> +		return -ENOSPC;
> +
> +	atomic_inc(&current->user->inotify_devs);
> +
> +	dev = kmalloc(sizeof(struct inotify_device), GFP_KERNEL);
> +	if (!dev)
> +		return -ENOMEM;

Looks like these error conditions leak a refcount on the user_struct.

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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic