]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/ioprio.c
ioprio: fix RCU locking around task dereference
[net-next-2.6.git] / fs / ioprio.c
index 748cfb92dcc6203897c62d87ee113876f197a28b..8def14e24c3758ed95571dd89c05d3d58586c768 100644 (file)
@@ -139,7 +139,12 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
                                break;
 
                        do_each_thread(g, p) {
-                               if (__task_cred(p)->uid != who)
+                               int match;
+
+                               rcu_read_lock();
+                               match = __task_cred(p)->uid == who;
+                               rcu_read_unlock();
+                               if (!match)
                                        continue;
                                ret = set_task_ioprio(p, ioprio);
                                if (ret)
@@ -232,7 +237,12 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
                                break;
 
                        do_each_thread(g, p) {
-                               if (__task_cred(p)->uid != user->uid)
+                               int match;
+
+                               rcu_read_lock();
+                               match = __task_cred(p)->uid == user->uid;
+                               rcu_read_unlock();
+                               if (!match)
                                        continue;
                                tmpio = get_task_ioprio(p);
                                if (tmpio < 0)