[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9f37165a-5cdb-a688-2595-6cc9bf0e5e43@amd.com>
Date: Wed, 5 Apr 2023 14:29:06 -0400
From: Hamza Mahfooz <hamza.mahfooz@....com>
To: Igor Artemiev <Igor.A.Artemiev@...t.ru>,
David Airlie <airlied@...il.com>
Cc: lvc-project@...uxtesting.org,
Harry Wentland <harry.wentland@....com>,
Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
linux-kernel@...r.kernel.org, amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, Daniel Vetter <daniel@...ll.ch>,
Alex Deucher <alexander.deucher@....com>,
Nicholas Kazlauskas <Nicholas.Kazlauskas@....com>
Subject: Re: [PATCH] drm/amd/display: Fix potential null dereference
On 4/3/23 09:10, Igor Artemiev wrote:
> The adev->dm.dc pointer can be NULL and dereferenced in amdgpu_dm_fini()
> without checking.
>
> Add a NULL pointer check before calling dc_dmub_srv_destroy().
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 9a71c7d31734 ("drm/amd/display: Register DMUB service with DC")
> Signed-off-by: Igor Artemiev <Igor.A.Artemiev@...t.ru>
Applied, thanks!
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
> 1 file changed, 2 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 a01fd41643fc..27f7a554874e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1854,7 +1854,8 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
> dc_deinit_callbacks(adev->dm.dc);
> #endif
>
> - dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
> + if (adev->dm.dc)
> + dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
>
> if (dc_enable_dmub_notifications(adev->dm.dc)) {
> kfree(adev->dm.dmub_notify);
--
Hamza
Powered by blists - more mailing lists