Re: [PATCH 1/2] drm/msm: dpu: Fix memory leak caused by dropped reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 09, 2018 at 11:43:25AM -0700, Jeykumar Sankaran wrote:
> On 2018-10-04 11:09, Sean Paul wrote:
> > From: Sean Paul <seanpaul@xxxxxxxxxxxx>
> > 
> > We are currently leaking a drm_crtc_commit struct for every atomic
> > commit containing plane state. The dpu plane destroy function cleans up
> dpu plane destroy -> dpu_plane_destroy_state
> > the fb reference manually, but fails to release the commit ref. As a
> > result, we just keep allocating drm_crtc_commits without ever freeing
> > them. Fortunately there's a helper function which will clean up all of
> > our mess at once, so use that.
> > 
> > Thanks to Doug Anderson for reporting the memory leak (and leaving
> > breadcrumbs from kmemleak!).
> > 
> > Reported-by: Doug Anderson <dianders@xxxxxxxxxxxx>
> > Signed-off-by: Sean Paul <seanpaul@xxxxxxxxxxxx>
> > ---
> With the nit addressed:

FYI, this already picked up in msm-next last week.

> 
> Reviewed-by: Jeykumar Sankaran <jsanka@xxxxxxxxxxxxxx>
> 
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> > b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> > index fc59a69aa832..f549daf30fe6 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> > @@ -1203,9 +1203,7 @@ static void dpu_plane_destroy_state(struct
> > drm_plane
> > *plane,
> > 
> >  	pstate = to_dpu_plane_state(state);
> > 
> > -	/* remove ref count for frame buffers */
> > -	if (state->fb)
> > -		drm_framebuffer_put(state->fb);
> > +	__drm_atomic_helper_plane_destroy_state(state);
> > 
> >  	kfree(pstate);
> >  }
> 
> -- 
> Jeykumar S

-- 
Sean Paul, Software Engineer, Google / Chromium OS



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux