All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Jesse(Jie)" <Jesse.Zhang@amd.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>,
	"Huang, Tim" <Tim.Huang@amd.com>
Subject: RE: [PATCH 01/22] drm/amdgpu: fix dereference after null check
Date: Tue, 14 May 2024 02:39:30 +0000	[thread overview]
Message-ID: <DM4PR12MB51528E29DDF26DB21C602DD7E3E32@DM4PR12MB5152.namprd12.prod.outlook.com> (raw)
In-Reply-To: <1a0b28c7-0b01-4e8e-ae8b-8eb297da1e05@gmail.com>

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Christian,

-----Original Message-----
From: Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Monday, May 13, 2024 7:41 PM
To: Zhang, Jesse(Jie) <Jesse.Zhang@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Huang, Tim <Tim.Huang@amd.com>
Subject: Re: [PATCH 01/22] drm/amdgpu: fix dereference after null check

Am 10.05.24 um 04:50 schrieb Jesse Zhang:
> check the pointer hive before use.
>
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 77f6fd50002a..00fe3c2d5431 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -5725,7 +5725,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
>        * to put adev in the 1st position.
>        */
>       INIT_LIST_HEAD(&device_list);
> -     if (!amdgpu_sriov_vf(adev) && (adev->gmc.xgmi.num_physical_nodes > 1)) {
> +     if (!amdgpu_sriov_vf(adev) && (adev->gmc.xgmi.num_physical_nodes >
> +1) && hive) {

That solution looks not optimal to me.

Checking adev->gmc.xgmi.num_physical_nodes > 1 already makes sure that hive shouldn't be NULL.

If automated checkers complain about that we should probably drop the
adev->gmc.xgmi.num_physical_nodes > 1 check and check for hive instead.

[Zhang, Jesse(Jie)]
gmc.xgmi.num_physical_nodes is obtained by reading register GCMC_VM_XGMI_LFB_CNTL.
But getting hive may fail because of  no memory (NOMEM),
or the kobject of xgmi hive cannot be initialized in the function amdgpu_get_xgmi_hive.
Is (adev->gmc.xgmi.num_physical_nodes > 1) equivalent to (!hive) here?

Regards
Jesse

Regards,
Christian.

>               list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {
>                       list_add_tail(&tmp_adev->reset_list, &device_list);
>                       if (adev->shutdown)


      reply	other threads:[~2024-05-14  2:39 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10  2:50 [PATCH 01/22] drm/amdgpu: fix dereference after null check Jesse Zhang
2024-05-10  2:50 ` [PATCH 02/22] drm/amdgpu: the warning dereferencing obj for nbio_v7_4 Jesse Zhang
2024-05-13  2:18   ` Zhang, Jesse(Jie)
2024-05-13  4:22     ` Huang, Tim
2024-05-13  6:29       ` Zhang, Jesse(Jie)
2024-05-10  2:50 ` [PATCH 03/22] drm/amdgpu: fix the waring dereferencing hive Jesse Zhang
2024-05-10  6:20   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 04/22] drm/amd: fix the warning unchecking return vaule for sdma_v7 Jesse Zhang
2024-05-10  6:27   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 05/22] drm/amd/pm: check specific index for aldebaran Jesse Zhang
2024-05-10  3:28   ` Wang, Yang(Kevin)
2024-05-10  6:29   ` Huang, Tim
2024-05-13 11:08   ` Lazar, Lijo
2024-05-10  2:50 ` [PATCH 06/22] drm/amd/pm: check the return of send smc msg for sienna_cichild Jesse Zhang
2024-05-10  7:41   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 07/22] drm/amd/pm: check the return of send smc msg for navi10 Jesse Zhang
2024-05-10  7:42   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 08/22] drm/amd/pm: check the return of send smc msg for smu_v13 Jesse Zhang
2024-05-10  7:42   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 09/22] drm/amd/pm: check specific index for smu13 Jesse Zhang
2024-05-10  3:26   ` Wang, Yang(Kevin)
2024-05-10  6:37   ` Huang, Tim
2024-05-10  6:52     ` Zhang, Jesse(Jie)
2024-05-13 10:57   ` Lazar, Lijo
2024-05-13 11:04     ` Lazar, Lijo
2024-05-10  2:50 ` [PATCH 10/22] drm/amdgpu: remove structurally dead code Jesse Zhang
2024-05-10  6:38   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 11/22] drm/amdgpu: remove structurally dead code for amd_gmc Jesse Zhang
2024-05-10  6:39   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 12/22] drm/amd/pm: remove logically dead code Jesse Zhang
2024-05-13  2:19   ` Zhang, Jesse(Jie)
2024-05-13  2:58     ` Wang, Yang(Kevin)
2024-05-10  2:50 ` [PATCH 13/22] drm/amd/pm: remove logically dead code for renoir Jesse Zhang
2024-05-10  3:34   ` Wang, Yang(Kevin)
2024-05-10  2:50 ` [PATCH 14/22] drm/amdgu: remove unused code Jesse Zhang
2024-05-10  6:43   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 15/22] drm/amd/pm: fix enum feature compared against 0 Jesse Zhang
2024-05-10  3:29   ` Wang, Yang(Kevin)
2024-05-10  6:42   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 16/22] drm/amd/pm: fix enum type " Jesse Zhang
2024-05-10  6:45   ` Huang, Tim
2024-05-10  2:50 ` [PATCH 17/22] drm/amdgpu: fix the warning bad bit shift operation for aca_error_type type Jesse Zhang
2024-05-13  2:18   ` Zhang, Jesse(Jie)
2024-05-13  2:53     ` Wang, Yang(Kevin)
2024-05-10  2:50 ` [PATCH 18/22] drm/amd/pm: check negtive return for table entries Jesse Zhang
2024-05-13  2:19   ` Zhang, Jesse(Jie)
2024-05-13  4:06     ` Huang, Tim
2024-05-10  2:50 ` [PATCH 19/22] drm/amdgpu: Fix the warning division or modulo by zero for the variable num_xcc_per_xcp Jesse Zhang
2024-05-10  6:51   ` Huang, Tim
2024-05-10  7:16   ` Lazar, Lijo
2024-05-10  7:39     ` Zhang, Jesse(Jie)
2024-05-10  7:47       ` Lazar, Lijo
2024-05-10  2:50 ` [PATCH 20/22] drm/amd/pm: fix get dpm level count for smu13 Jesse Zhang
2024-05-10  5:43   ` Zhang, Yifan
2024-05-10  2:50 ` [PATCH 21/22] drm/amd/pm: fix get dpm level count for yello carp Jesse Zhang
2024-05-10  5:44   ` Zhang, Yifan
2024-05-10  2:50 ` [PATCH 22/22] drm/amdgpu: clear the warning unsigned compared against 0 for xcp_id Jesse Zhang
2024-05-10  6:52   ` Huang, Tim
2024-05-10  6:05 ` [PATCH 01/22] drm/amdgpu: fix dereference after null check Huang, Tim
2024-05-13 11:41 ` Christian König
2024-05-14  2:39   ` Zhang, Jesse(Jie) [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=DM4PR12MB51528E29DDF26DB21C602DD7E3E32@DM4PR12MB5152.namprd12.prod.outlook.com \
    --to=jesse.zhang@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Tim.Huang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ckoenig.leichtzumerken@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.