[Intel-gfx] [PATCH] i915: fix memory leak with using debugfs_lookup()
Zhenyu Wang
zhenyuw at linux.intel.com
Thu Feb 23 05:41:00 UTC 2023
On 2023.02.06 15:23:55 -0500, Rodrigo Vivi wrote:
> On Thu, Feb 02, 2023 at 03:13:09PM +0100, 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: Zhenyu Wang <zhenyuw at linux.intel.com>
> > Cc: Zhi Wang <zhi.a.wang at intel.com>
> > Cc: Jani Nikula <jani.nikula at linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
> > Cc: David Airlie <airlied at gmail.com>
> > Cc: Daniel Vetter <daniel at ffwll.ch>
> > Cc: intel-gvt-dev at lists.freedesktop.org
> > Cc: intel-gfx at lists.freedesktop.org
> > Cc: dri-devel at lists.freedesktop.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
>
>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
>
> Zhenyu or Zhi, could you please propagate this through your gvt branch?
>
Sorry I missed this one after I migrated my mail stuff onto new machine..
Looks good to me.
Reviewed-by: Zhenyu Wang <zhenyuw at linux.intel.com>
> > drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > index 8ae7039b3683..de675d799c7d 100644
> > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > @@ -699,7 +699,7 @@ static void intel_vgpu_close_device(struct vfio_device *vfio_dev)
> >
> > clear_bit(INTEL_VGPU_STATUS_ATTACHED, vgpu->status);
> >
> > - debugfs_remove(debugfs_lookup(KVMGT_DEBUGFS_FILENAME, vgpu->debugfs));
> > + debugfs_lookup_and_remove(KVMGT_DEBUGFS_FILENAME, vgpu->debugfs);
> >
> > kvm_page_track_unregister_notifier(vgpu->vfio_device.kvm,
> > &vgpu->track_node);
> > --
> > 2.39.1
> >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230223/bb243567/attachment.sig>
More information about the dri-devel
mailing list