[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_PoJ2GiigfBt87EoE3GYLOFiOvsmBRF74TK6MtRc+t5jw@mail.gmail.com>
Date: Tue, 13 Sep 2022 08:54:02 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Rafael Mendonca <rafaelmendsr@...il.com>
Cc: Harry Wentland <harry.wentland@....com>,
Leo Li <sunpeng.li@....com>,
Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>, Wayne Lin <Wayne.Lin@....com>,
Mikita Lipski <mikita.lipski@....com>,
Nicholas Kazlauskas <Nicholas.Kazlauskas@....com>,
dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/amdgpu: Fix memory leak in hpd_rx_irq_create_workqueue()
Applied. Thanks!
On Mon, Sep 12, 2022 at 10:12 PM Rafael Mendonca <rafaelmendsr@...il.com> wrote:
>
> If construction of the array of work queues to handle hpd_rx_irq offload
> work fails, we need to unwind. Destroy all the created workqueues and
> the allocated memory for the hpd_rx_irq_offload_work_queue struct array.
>
> Fixes: 8e794421bc98 ("drm/amd/display: Fork thread to offload work of hpd_rx_irq")
> Signed-off-by: Rafael Mendonca <rafaelmendsr@...il.com>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> 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 5140d9c2bf3b..6a2e455c5466 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1295,13 +1295,21 @@ static struct hpd_rx_irq_offload_work_queue *hpd_rx_irq_create_workqueue(struct
>
> if (hpd_rx_offload_wq[i].wq == NULL) {
> DRM_ERROR("create amdgpu_dm_hpd_rx_offload_wq fail!");
> - return NULL;
> + goto out_err;
> }
>
> spin_lock_init(&hpd_rx_offload_wq[i].offload_lock);
> }
>
> return hpd_rx_offload_wq;
> +
> +out_err:
> + for (i = 0; i < max_caps; i++) {
> + if (hpd_rx_offload_wq[i].wq)
> + destroy_workqueue(hpd_rx_offload_wq[i].wq);
> + }
> + kfree(hpd_rx_offload_wq);
> + return NULL;
> }
>
> struct amdgpu_stutter_quirk {
> --
> 2.34.1
>
Powered by blists - more mailing lists