dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* Potential NULL pointer deference in drm/amdgpu
@ 2019-10-10  5:09 Yizhuo Zhai
  2019-10-10  6:52 ` Koenig, Christian
  0 siblings, 1 reply; 2+ messages in thread
From: Yizhuo Zhai @ 2019-10-10  5:09 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David (ChunMing) Zhou,
	David Airlie, Daniel Vetter, Sam Ravnborg, Evan Quan, Jack Xiao,
	amd-gfx, dri-devel, linux-kernel, Zhiyun Qian, Chengyu Song

Hi All:
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:
The function to_amdgpu_fence() could return NULL, but callers
in this file does not check the return value but directly dereference it,
which seems potentially unsafe.
Such callers include amdgpu_fence_get_timeline_name(),
amdgpu_fence_enable_signaling() and amdgpu_fence_free().


-- 
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Potential NULL pointer deference in drm/amdgpu
  2019-10-10  5:09 Potential NULL pointer deference in drm/amdgpu Yizhuo Zhai
@ 2019-10-10  6:52 ` Koenig, Christian
  0 siblings, 0 replies; 2+ messages in thread
From: Koenig, Christian @ 2019-10-10  6:52 UTC (permalink / raw)
  To: Yizhuo Zhai, Deucher, Alexander, Zhou, David(ChunMing),
	David Airlie, Daniel Vetter, Sam Ravnborg, Quan, Evan, Xiao,
	Jack, amd-gfx, dri-devel, linux-kernel, Zhiyun Qian,
	Chengyu Song

Hi Yizhuo,

Am 10.10.19 um 07:09 schrieb Yizhuo Zhai:
> Hi All:
> drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:
> The function to_amdgpu_fence() could return NULL, but callers
> in this file does not check the return value but directly dereference it,
> which seems potentially unsafe.
> Such callers include amdgpu_fence_get_timeline_name(),
> amdgpu_fence_enable_signaling() and amdgpu_fence_free().

That is expected behavior and no need to worry.

The functions in amdgpu_fence.c are the callbacks to implement 
amdgpu_fence_ops. The function to_amdgpu_fence() checks if the ops of 
the fence are amdgpu_fence_ops, so it is guaranteed that the functions 
are called with an amdgpu_fence structure.

Regards,
Christian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-10  6:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10  5:09 Potential NULL pointer deference in drm/amdgpu Yizhuo Zhai
2019-10-10  6:52 ` Koenig, Christian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).