aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2015-12-17 16:47:46 -0500
committerBjoern Brandenburg <bbb@mpi-sws.org>2015-12-18 03:34:51 -0500
commit3b688190e1d840b8357aae765911f0f00621e26f (patch)
treecb10f965fdf79d91e9a9db815db947961859f9e0
parent3e0c32c25e6f32c24c53c0a401d67f1c05576c38 (diff)
Fix RCU locking in sys_get_rt_task_param()
sys_get_rt_task_param() is rarely used and apparently attracted some bitrot.
-rw-r--r--litmus/litmus.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c
index db5ce0e9c76e..885d75493118 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -184,21 +184,24 @@ asmlinkage long sys_get_rt_task_param(pid_t pid, struct rt_task __user * param)
184 int retval = -EINVAL; 184 int retval = -EINVAL;
185 struct task_struct *source; 185 struct task_struct *source;
186 struct rt_task lp; 186 struct rt_task lp;
187
187 if (param == 0 || pid < 0) 188 if (param == 0 || pid < 0)
188 goto out; 189 goto out;
189 read_lock(&tasklist_lock); 190
190 if (!(source = find_task_by_vpid(pid))) { 191 read_lock_irq(&tasklist_lock);
192 rcu_read_lock();
193 source = find_task_by_vpid(pid);
194 rcu_read_unlock();
195 if (!source) {
191 retval = -ESRCH; 196 retval = -ESRCH;
192 goto out_unlock; 197 read_unlock_irq(&tasklist_lock);
198 goto out;
193 } 199 }
194 lp = source->rt_param.task_params; 200 lp = source->rt_param.task_params;
195 read_unlock(&tasklist_lock); 201 read_unlock_irq(&tasklist_lock);
196 /* Do copying outside the lock */ 202 /* Do copying outside the lock */
197 retval = 203 retval =
198 copy_to_user(param, &lp, sizeof(lp)) ? -EFAULT : 0; 204 copy_to_user(param, &lp, sizeof(lp)) ? -EFAULT : 0;
199 return retval;
200 out_unlock:
201 read_unlock(&tasklist_lock);
202 out: 205 out:
203 return retval; 206 return retval;
204 207