Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdkfd: potential error pointer dereference in ioctl

The "target" either comes from kfd_create_process() which returns error
pointers on error or kfd_lookup_process_by_pid() which returns NULL on
error. So we need to check for both types of errors.

Fixes: 0ab2d7532b05 ("drm/amdkfd: prepare per-process debug enable and disable")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dan Carpenter and committed by
Alex Deucher
8be29504 33e82119

+2 -2
+2 -2
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
··· 2920 2920 target = kfd_lookup_process_by_pid(pid); 2921 2921 } 2922 2922 2923 - if (!target) { 2923 + if (IS_ERR_OR_NULL(target)) { 2924 2924 pr_debug("Cannot find process PID %i to debug\n", args->pid); 2925 - r = -ESRCH; 2925 + r = target ? PTR_ERR(target) : -ESRCH; 2926 2926 goto out; 2927 2927 } 2928 2928