Re: [PATCH v2] mm/damon/dbgfs: fix memory leak when using
From: Greg KH
Date: Sat Sep 03 2022 - 01:36:36 EST
On Fri, Sep 02, 2022 at 07:11:49PM +0000, SeongJae Park wrote:
> From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> debugfs_lookup()
> Date: Fri, 2 Sep 2022 14:56:31 +0200 [thread overview]
> Message-ID: <20220902125631.128329-1-gregkh@xxxxxxxxxxxxxxxxxxx> (raw)
>
> When calling debugfs_lookup() the result must have dput() called on it,
> otherwise the memory will leak over time. Fix this up by properly
> calling dput().
>
> Fixes: 75c1c2b53c78b ("mm/damon/dbgfs: support multiple contexts")
> Cc: <stable@xxxxxxxxxxxxxxx> # 5.15.x
> Cc: SeongJae Park <sj@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: damon@xxxxxxxxxxxxxxx
> Cc: linux-mm@xxxxxxxxx
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
> ---
> Changes from v1
> (https://lore.kernel.org/damon/20220902125631.128329-1-gregkh@xxxxxxxxxxxxxxxxxxx/)
> - Call dput() for failure-return case (Andrew Morton)
Thanks for fixing this up, I missed the other return error cases in my
rush to audit the whole tree at once.
This version looks great, and I see Andrew has taken it now into his
tree, thanks!
greg k-h