Re: [PATCH] kernel/fail_function: fix memory leak with using debugfs_lookup()

From: Yang Yingliang
Date: Fri Feb 03 2023 - 03:13:31 EST



On 2023/2/2 23:16, Greg Kroah-Hartman wrote:
When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time. To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic
at once.

Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

Reviewed-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>