mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: add mutex to serialize profiler ioctl calls
Add new mutex prof->ioctl_lock to serialize all IOCTL calls on profiler object. Running concurrent IOCTL calls could lead to races and corrupted state. Bug 2510974 Jira NVGPU-5360 Change-Id: I66a8d9078c35475a13442ccd34b61aca5b9c1d2b Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2389652 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Alex Waterman
parent
9ea21459b4
commit
ccba2e850b
@@ -200,6 +200,8 @@ long nvgpu_prof_fops_ioctl(struct file *filp, unsigned int cmd,
|
||||
nvgpu_log(g, gpu_dbg_prof, "Profiler handle %u received IOCTL cmd %u",
|
||||
prof->prof_handle, cmd);
|
||||
|
||||
nvgpu_mutex_acquire(&prof->ioctl_lock);
|
||||
|
||||
nvgpu_speculation_barrier();
|
||||
|
||||
switch (cmd) {
|
||||
@@ -218,6 +220,8 @@ long nvgpu_prof_fops_ioctl(struct file *filp, unsigned int cmd,
|
||||
break;
|
||||
}
|
||||
|
||||
nvgpu_mutex_release(&prof->ioctl_lock);
|
||||
|
||||
if ((err == 0) && (_IOC_DIR(cmd) & _IOC_READ))
|
||||
err = copy_to_user((void __user *)arg,
|
||||
buf, _IOC_SIZE(cmd));
|
||||
|
||||
Reference in New Issue
Block a user