Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1572350
| Path | csiph.com!news.mixmin.net!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] block: Use for_each_thread() in sys_ioprio_set()/sys_ioprio_get() |
| Date | Thu, 02 Feb 2017 14:30:02 +0100 |
| Message-ID | <t6pCy-4Bc-19@gated-at.bofh.it> (permalink) |
| X-Original-To | akpm@linux-foundation.org |
| X-Virus-Status | clean(F-Secure/fsigk_smtp/530/fsav305.sakura.ne.jp) |
| X-Mailer | git-send-email 1.8.3.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 54 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>, Oleg Nesterov <oleg@redhat.com> |
| X-Original-Date | Thu, 2 Feb 2017 22:22:58 +0900 |
| X-Original-Message-ID | <1486041779-4401-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1572350 |
Show key headers only | View raw
IOPRIO_WHO_USER case in sys_ioprio_set()/sys_ioprio_get() are using
while_each_thread(), which is unsafe under RCU lock according to
commit 0c740d0afc3bff0a ("introduce for_each_thread() to replace
the buggy while_each_thread()"). Use for_each_thread() which is
safe under RCU lock.
Link: http://lkml.kernel.org/r/201702011947.DBD56740.OMVHOLOtSJFFFQ@I-love.SAKURA.ne.jp
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
---
block/ioprio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/ioprio.c b/block/ioprio.c
index 01b8116..3790669 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -122,14 +122,14 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
if (!user)
break;
- do_each_thread(g, p) {
+ for_each_process_thread(g, p) {
if (!uid_eq(task_uid(p), uid) ||
!task_pid_vnr(p))
continue;
ret = set_task_ioprio(p, ioprio);
if (ret)
goto free_uid;
- } while_each_thread(g, p);
+ }
free_uid:
if (who)
free_uid(user);
@@ -222,7 +222,7 @@ int ioprio_best(unsigned short aprio, unsigned short bprio)
if (!user)
break;
- do_each_thread(g, p) {
+ for_each_process_thread(g, p) {
if (!uid_eq(task_uid(p), user->uid) ||
!task_pid_vnr(p))
continue;
@@ -233,7 +233,7 @@ int ioprio_best(unsigned short aprio, unsigned short bprio)
ret = tmpio;
else
ret = ioprio_best(ret, tmpio);
- } while_each_thread(g, p);
+ }
if (who)
free_uid(user);
--
1.8.3.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 1/2] block: Use for_each_thread() in sys_ioprio_set()/sys_ioprio_get() Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-02-02 14:30 +0100 [PATCH 2/2] pid: Use for_each_thread() in do_each_pid_thread() Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-02-02 14:30 +0100
csiph-web