Commit 9ee41d18 authored by Mukul Joshi's avatar Mukul Joshi Committed by Zheng Zucheng
Browse files

drm/amdkfd: Rework kfd_locked handling

mainline inclusion
from mainline-v6.5-rc1
commit fe1f05df
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9U8NU
CVE: CVE-2024-36949

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fe1f05df5919c67c3add49efb55e251a8d78ee4e



--------------------------------

Currently, even if kfd_locked is set, a process is first
created and then removed to work around a race condition
in updating kfd_locked flag. Rework kfd_locked handling to
ensure no processes is created if kfd_locked is set. This
is achieved by updating kfd_locked under kfd_processes_mutex.
With this there is no need for kfd_locked to be an atomic
counter. Instead, it can be a regular integer.

Signed-off-by: default avatarMukul Joshi <mukul.joshi@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>

Conflicts:
    drivers/gpu/drm/amd/amdkfd/kfd_device.c
    drivers/gpu/drm/amd/amdkfd/kfd_process.c
    drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
    drivers/gpu/drm/amd/amdkfd/kfd_priv.h
[Some contexts different. No functional impact.]
Signed-off-by: default avatarZheng Zucheng <zhengzucheng@huawei.com>
parent f102707f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment