drm/amd: add the checking to avoid NULL pointer dereference
Subsystems (2)
PATCH 1/1 drm/amd: add the checking to avoid NULL pointer dereference
when returned fence is not valid mostly due to userspace ignored previous error causes NULL pointer dereference
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
@@ -1420,6 +1420,8 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, fence =amdgpu_cs_get_fence (adev, filp, &info->in.fence);if (IS_ERR (fence))return PTR_ERR (fence); +if (!fence) +return -EINVAL ;switch (info->in.what) {case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ :
Signature · 6 lines
2.15.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20181122023610.22058-1-Deepak.Sharma-5C7GfCeVMHo@public.gmane.org
Quoted 25 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Sharma, Deepak
Sent: Thursday, November 22, 2018 10:37 AM
To: [email protected]
Cc: Sharma, Deepak <[email protected]>
Subject: [PATCH] drm/amd: add the checking to avoid NULL pointer dereferencewhen returned fence is not valid mostly due to userspace ignored previous error causes NULL pointer dereference
Signed-off-by Deepak Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_fence_to_handle_ioctl(struct · line 1425
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2
-0@@ -1420,6 +1420,8 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, fence =amdgpu_cs_get_fence (adev, filp, &info->in.fence);if (IS_ERR (fence))return PTR_ERR (fence); +if (!fence) +return -EINVAL ;
Could you move them into the end of amdgpu_cs_get_fence()? Like:
If (!fence)
return ERR_PTR(-EINVAL);
Thanks,
-David
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-1switch (info->in.what) {case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ : --2.15.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
NAKAm 22.11.18 um 03:36 schrieb Sharma, Deepak:
Quoted 2 lines
when returned fence is not valid mostly due to userspace ignored previous error causes NULL pointer dereference
NAK, when the fence is NULL then this means it is already signaled and no longer in the container.
In other words this is a normal case and the following functions need to be able to handle that.
Christian.
Quoted 11 lines
Signed-off-by Deepak Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, · line 1427
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2
-0@@ -1420,6 +1420,8 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, fence =amdgpu_cs_get_fence (adev, filp, &info->in.fence);if (IS_ERR (fence))return PTR_ERR (fence); +if (!fence) +return -EINVAL ;switch (info->in.what) {case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ :
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx