[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YxIX96nUnwz56fte@ZenIV>
Date: Fri, 2 Sep 2022 15:49:27 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Kuyo Chang <kuyo.chang@...iatek.com>, major.chen@...sung.com,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Matthias Brugger <matthias.bgg@...il.com>,
wsd_upstream@...iatek.com, hongfei.tang@...sung.com,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH 1/1] sched/debug: fix dentry leak in
update_sched_domain_debugfs
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... ;-/
Powered by blists - more mailing lists