[PATCH 1/1] sched/debug: fix dentry leak in update_sched_domain_debugfs
Al Viro
viro at zeniv.linux.org.uk
Fri Sep 2 07:49:27 PDT 2022
On Fri, Sep 02, 2022 at 11:11:54AM +0200, Greg Kroah-Hartman wrote:
> +/**
> + * debugfs_lookup_and_remove - lookup a directory or file and recursively remove it
> + * @name: a pointer to a string containing the name of the item to look up.
> + * @parent: a pointer to the parent dentry of the item.
> + *
> + * This is the equlivant of doing something like
> + * debugfs_remove(debugfs_lookup(..)) but with the proper reference counting
> + * handled for the directory being looked up.
> + */
> +void debugfs_lookup_and_remove(const char *name, struct dentry *parent)
> +{
> + struct dentry *dentry;
> +
> + dentry = debugfs_lookup(name, parent);
> + if (IS_ERR_OR_NULL(dentry))
> + return;
Could somebody explain how could that return ERR_PTR()?
Incidentally, IS_ERR_OR_NULL is almost always a sign of bad interface - or
that of lazy cargo-culting. Please, don't propagate that garbage... ;-/
More information about the linux-arm-kernel
mailing list