Re: [PATCH] HV: hv_balloon: fix memory leak with using debugfs_lookup()

From: Greg Kroah-Hartman
Date: Fri Feb 03 2023 - 01:47:04 EST


On Fri, Feb 03, 2023 at 03:56:06AM +0000, Michael Kelley (LINUX) wrote:
> From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Sent: Thursday, February 2, 2023 6:09 AM
>
> >
> > 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: "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>
> > Cc: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
> > Cc: Wei Liu <wei.liu@xxxxxxxxxx>
> > Cc: Dexuan Cui <decui@xxxxxxxxxxxxx>
> > Cc: linux-hyperv@xxxxxxxxxxxxxxx
> > Cc: linux-kernel@xxxxxxxxxxxxxxx
> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> Add a Fixes: tag? This hv_balloon debugfs code was added in v6.0,
> And I see that debugfs_lookup_and_remove() was also added in v6.0.
>
> Fixes: d180e0a1be6c ("Drivers: hv: Create debugfs file with hyper-v balloon usage information")

Will do, thanks.

greg k-h