* [PATCH] amdgpu_dm_2027: Add pointer check
@ 2022-11-11 7:14 Denis Arefev
2022-11-11 15:05 ` Harry Wentland
0 siblings, 1 reply; 2+ messages in thread
From: Denis Arefev @ 2022-11-11 7:14 UTC (permalink / raw)
To: Harry Wentland
Cc: Leo Li, Alex Deucher, Christian König, David Airlie,
Daniel Vetter, amd-gfx, dri-devel, linux-kernel, trufanov
Return value of a function 'dc_create_state' is
dereferenced at amdgpu_dm.c:2027 without checking for null
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
1 file changed, 3 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 0f7749e9424d..529483997154 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1960,7 +1960,9 @@ static int dm_resume(void *handle)
dc_release_state(dm_state->context);
dm_state->context = dc_create_state(dm->dc);
/* TODO: Remove dc_state->dccg, use dc->dccg directly. */
- dc_resource_state_construct(dm->dc, dm_state->context);
+ if (dm_state->context) {
+ dc_resource_state_construct(dm->dc, dm_state->context);
+ }
/* Before powering on DC we need to re-initialize DMUB. */
r = dm_dmub_hw_init(adev);
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] amdgpu_dm_2027: Add pointer check
2022-11-11 7:14 [PATCH] amdgpu_dm_2027: Add pointer check Denis Arefev
@ 2022-11-11 15:05 ` Harry Wentland
0 siblings, 0 replies; 2+ messages in thread
From: Harry Wentland @ 2022-11-11 15:05 UTC (permalink / raw)
To: Denis Arefev
Cc: Leo Li, Alex Deucher, Christian König, David Airlie,
Daniel Vetter, amd-gfx, dri-devel, linux-kernel, trufanov
The commit title should user the drm/amd/display prefix.
It might also be good to be more specific, like:
drm/amd/display: Check dc_resource_state_construct succeeded
On 11/11/22 02:14, Denis Arefev wrote:
> Return value of a function 'dc_create_state' is
> dereferenced at amdgpu_dm.c:2027 without checking for null
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
Does this fix a test case? If so, please describe.
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
> 1 file changed, 3 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 0f7749e9424d..529483997154 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1960,7 +1960,9 @@ static int dm_resume(void *handle)
> dc_release_state(dm_state->context);
> dm_state->context = dc_create_state(dm->dc);
> /* TODO: Remove dc_state->dccg, use dc->dccg directly. */
> - dc_resource_state_construct(dm->dc, dm_state->context);
> + if (dm_state->context) {
> + dc_resource_state_construct(dm->dc, dm_state->context);
> + }
I don't see how this won't leave the driver state in a
mess. Are you sure this isn't a fatal error?
Harry
>
> /* Before powering on DC we need to re-initialize DMUB. */
> r = dm_dmub_hw_init(adev);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-11 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11 7:14 [PATCH] amdgpu_dm_2027: Add pointer check Denis Arefev
2022-11-11 15:05 ` Harry Wentland
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®