Re: [patch] inotify: a replacement for dnotify

From: Chris Wright
Date: Tue Nov 30 2004 - 18:09:36 EST


* Robert Love (rml@xxxxxxxxxx) 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/