[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bee381b3-305b-46e5-ae59-d816c491fce5@nppct.ru>
Date: Wed, 4 Jun 2025 22:30:43 +0300
From: SDL <sdl@...ct.ru>
To: Alex Deucher <alexdeucher@...il.com>
Cc: Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Sunil Khatri <sunil.khatri@....com>, Vitaly Prosyak
<vitaly.prosyak@....com>, Srinivasan Shanmugam
<srinivasan.shanmugam@....com>, Jiadong Zhu <Jiadong.Zhu@....com>,
Yang Wang <kevinyang.wang@....com>, Prike Liang <Prike.Liang@....com>,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org,
stable@...r.kernel.org
Subject: Re: [PATCH] drm/amdgpu: fix NULL dereference in gfx_v9_0_kcq() and
kiq_init_queue()
> On Sat, May 24, 2025 at 2:14 AM Alexey Nepomnyashih <sdl@...ct.ru> wrote:
>> A potential NULL pointer dereference may occur when accessing
>> tmp_mqd->cp_hqd_pq_control without verifying that tmp_mqd is non-NULL.
>> This may happen if mqd_backup[mqd_idx] is unexpectedly NULL.
>>
>> Although a NULL check for mqd_backup[mqd_idx] existed previously, it was
>> moved to a position after the dereference in a recent commit, which
>> renders it ineffective.
> I don't think it's possible for mqd_backup to be NULL at this point.
> We would have failed earlier in init if the mqd backup allocation
> failed.
>
> Alex
In scenarios such as GPU reset or power management resume, there is no
strict
guarantee that amdgpu_gfx_mqd_sw_init() (via ->sw_init()) is invoked before
gfx_v9_0_kiq_init_queue(). As a result, mqd_backup[] may remain
uninitialized,
and dereferencing it without a NULL check can lead to a crash.
Most other uses of mqd_backup[] in the driver explicitly check for NULL,
indicating that uninitialized entries are an expected condition and
should be handled
accordingly.
Alexey
Powered by blists - more mailing lists