]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/amdkfd: Fix NULL pointer check order in kfd_ioctl_create_process
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Mon, 23 Mar 2026 08:58:57 +0000 (14:28 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 24 Mar 2026 17:29:40 +0000 (13:29 -0400)
commit19d4149b22f57094bfc4b86b742381b3ca394ead
tree52c22bd927db9974bbdd213ecde3fd89afa0422e
parent3f797396d7f4eb9bb6eded184bbc6f033628a6f6
drm/amdkfd: Fix NULL pointer check order in kfd_ioctl_create_process

In kfd_ioctl_create_process(), the pointer 'p' is used before checking
if it is NULL.

The code accesses p->context_id before validating 'p'. This can lead
to a possible NULL pointer dereference.

Move the NULL check before using 'p' so that the pointer is validated
before access.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_chardev.c:3177 kfd_ioctl_create_process() warn: variable dereferenced before check 'p' (see line 3174)

Fixes: cc6b66d661fd ("amdkfd: introduce new ioctl AMDKFD_IOC_CREATE_PROCESS")
Cc: Zhu Lingshan <lingshan.zhu@amd.com>
Cc: Felix Kuehling <felix.kuehling@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c