diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2010-11-09 15:26:56 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-11-10 08:40:53 -0500 |
commit | f85acd81aa623e3dcf268c90e5cd8ecf36830984 (patch) | |
tree | cb6baded85812573ad2f42bfe47b9d185b61918b | |
parent | 1447399b3e34af016c368b4178db7ef0e04e15b0 (diff) |
ioprio: rcu_read_lock/unlock protect find_task_by_vpid call (V2)
Commit 4221a9918e38b7494cee341dda7b7b4bb8c04bde "Add RCU check for
find_task_by_vpid()" introduced rcu_lockdep_assert to find_task_by_pid_ns=
Assertion failed in sys_ioprio_get. The patch is fixing assertion
failure in ioprio_set as well.
kernel/pid.c:419 invoked rcu_dereference_check() without protection!
stack backtrace:
Pid: 4254, comm: iotop Not tainted
Call Trace:
[<ffffffff810656f2>] lockdep_rcu_dereference+0xaa/0xb2
[<ffffffff81053c67>] find_task_by_pid_ns+0x4f/0x68
[<ffffffff81053c9d>] find_task_by_vpid+0x1d/0x1f
[<ffffffff811104e2>] sys_ioprio_get+0x50/0x2da
[<ffffffff81002182>] system_call_fastpath+0x16/0x1b
V2: rcu critical section expanded according to comment by Paul E. McKenney
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
-rw-r--r-- | fs/ioprio.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ioprio.c b/fs/ioprio.c index 8def14e24c37..2f7d05c89922 100644 --- a/fs/ioprio.c +++ b/fs/ioprio.c | |||
@@ -111,12 +111,14 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio) | |||
111 | read_lock(&tasklist_lock); | 111 | read_lock(&tasklist_lock); |
112 | switch (which) { | 112 | switch (which) { |
113 | case IOPRIO_WHO_PROCESS: | 113 | case IOPRIO_WHO_PROCESS: |
114 | rcu_read_lock(); | ||
114 | if (!who) | 115 | if (!who) |
115 | p = current; | 116 | p = current; |
116 | else | 117 | else |
117 | p = find_task_by_vpid(who); | 118 | p = find_task_by_vpid(who); |
118 | if (p) | 119 | if (p) |
119 | ret = set_task_ioprio(p, ioprio); | 120 | ret = set_task_ioprio(p, ioprio); |
121 | rcu_read_unlock(); | ||
120 | break; | 122 | break; |
121 | case IOPRIO_WHO_PGRP: | 123 | case IOPRIO_WHO_PGRP: |
122 | if (!who) | 124 | if (!who) |
@@ -205,12 +207,14 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) | |||
205 | read_lock(&tasklist_lock); | 207 | read_lock(&tasklist_lock); |
206 | switch (which) { | 208 | switch (which) { |
207 | case IOPRIO_WHO_PROCESS: | 209 | case IOPRIO_WHO_PROCESS: |
210 | rcu_read_lock(); | ||
208 | if (!who) | 211 | if (!who) |
209 | p = current; | 212 | p = current; |
210 | else | 213 | else |
211 | p = find_task_by_vpid(who); | 214 | p = find_task_by_vpid(who); |
212 | if (p) | 215 | if (p) |
213 | ret = get_task_ioprio(p); | 216 | ret = get_task_ioprio(p); |
217 | rcu_read_unlock(); | ||
214 | break; | 218 | break; |
215 | case IOPRIO_WHO_PGRP: | 219 | case IOPRIO_WHO_PGRP: |
216 | if (!who) | 220 | if (!who) |