aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-08-17 13:38:33 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-08-21 15:19:18 -0400
commitc4aed87630d41ee54e2ee23d4583c3dd423296dd (patch)
treed445a87cd9225254e6620b609acf549d8ca23f00
parentbce31d4c1ae8865d6382e3a27b07b4bb8e020ade (diff)
drm/amdgpu: fix incorrect use of drm_file->pid
That's the PID of the creator of the file (usually the X server) and not the end user of the file. Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> CC: stable@vger.kernel.org
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
index cb62a90d0686..1cafe8d83a4d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
@@ -55,7 +55,6 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
55{ 55{
56 struct file *filp = fget(fd); 56 struct file *filp = fget(fd);
57 struct drm_file *file; 57 struct drm_file *file;
58 struct pid *pid;
59 struct amdgpu_fpriv *fpriv; 58 struct amdgpu_fpriv *fpriv;
60 struct amdgpu_ctx *ctx; 59 struct amdgpu_ctx *ctx;
61 uint32_t id; 60 uint32_t id;
@@ -63,20 +62,10 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
63 if (!filp) 62 if (!filp)
64 return -EINVAL; 63 return -EINVAL;
65 64
66 pid = get_pid(((struct drm_file *)filp->private_data)->pid); 65 file = filp->private_data;
67 66 fpriv = file->driver_priv;
68 mutex_lock(&adev->ddev->filelist_mutex); 67 idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id)
69 list_for_each_entry(file, &adev->ddev->filelist, lhead) { 68 amdgpu_ctx_priority_override(ctx, priority);
70 if (file->pid != pid)
71 continue;
72
73 fpriv = file->driver_priv;
74 idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id)
75 amdgpu_ctx_priority_override(ctx, priority);
76 }
77 mutex_unlock(&adev->ddev->filelist_mutex);
78
79 put_pid(pid);
80 69
81 fput(filp); 70 fput(filp);
82 71