mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hamza Mahfooz <hamza.mahfooz@amd.com>
To: Igor Artemiev <Igor.A.Artemiev@mcst.ru>,
	David Airlie <airlied@gmail.com>
Cc: lvc-project@linuxtesting.org,
	Harry Wentland <harry.wentland@amd.com>,
	Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, Daniel Vetter <daniel@ffwll.ch>,
	Alex Deucher <alexander.deucher@amd.com>,
	Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Subject: Re: [PATCH] drm/amd/display: Fix potential null dereference
Date: Wed, 5 Apr 2023 14:29:06 -0400	[thread overview]
Message-ID: <9f37165a-5cdb-a688-2595-6cc9bf0e5e43@amd.com> (raw)
In-Reply-To: <20230403131037.1912215-1-Igor.A.Artemiev@mcst.ru>

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@mcst.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


      reply	other threads:[~2023-04-05 18:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 13:10 Igor Artemiev
2023-04-05 18:29 ` Hamza Mahfooz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f37165a-5cdb-a688-2595-6cc9bf0e5e43@amd.com \
    --to=hamza.mahfooz@amd.com \
    --cc=Igor.A.Artemiev@mcst.ru \
    --cc=Nicholas.Kazlauskas@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®