[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_NxEGXboksEV61XpixU+Vwj8q9A=cTvz_-BeapwN59+Mw@mail.gmail.com>
Date: Wed, 26 Aug 2020 09:45:11 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Dinghao Liu <dinghao.liu@....edu.cn>
Cc: Kangjie Lu <kjlu@....edu>, Stylon Wang <stylon.wang@....com>,
Leo Li <sunpeng.li@....com>,
Bhawanpreet Lakha <Bhawanpreet.Lakha@....com>,
Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
Roman Li <roman.li@....com>,
amd-gfx list <amd-gfx@...ts.freedesktop.org>,
Nicholas Kazlauskas <nicholas.kazlauskas@....com>,
David Airlie <airlied@...ux.ie>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>, Daniel Vetter <daniel@...ll.ch>,
Alex Deucher <alexander.deucher@....com>,
Mikita Lipski <mikita.lipski@....com>,
Harry Wentland <harry.wentland@....com>,
Christian König <christian.koenig@....com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/amd/display: Fix memleak in amdgpu_dm_mode_config_init
Applied. Thanks!
Alex
On Wed, Aug 26, 2020 at 9:37 AM Dinghao Liu <dinghao.liu@....edu.cn> wrote:
>
> When amdgpu_display_modeset_create_props() fails, state and
> state->context should be freed to prevent memleak. It's the
> same when amdgpu_dm_audio_init() fails.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index df9338257ae0..2476e40c67ef 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -2834,12 +2834,18 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
> &dm_atomic_state_funcs);
>
> r = amdgpu_display_modeset_create_props(adev);
> - if (r)
> + if (r) {
> + dc_release_state(state->context);
> + kfree(state);
> return r;
> + }
>
> r = amdgpu_dm_audio_init(adev);
> - if (r)
> + if (r) {
> + dc_release_state(state->context);
> + kfree(state);
> return r;
> + }
>
> return 0;
> }
> --
> 2.17.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Powered by blists - more mailing lists