]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix ioprio_get(IOPRIO_WHO_PGRP) vs setuid(2)
authorDavidlohr Bueso <dave@stgolabs.net>
Fri, 10 Dec 2021 18:20:58 +0000 (10:20 -0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 10 Dec 2021 18:26:07 +0000 (11:26 -0700)
commita77848c6a3f7f79f1a0bd46cf47c1e1775f823f7
tree5dbbaa64f3b99f6340475b25b58e0cd0d27b70b1
parent12403ccade3d98244cba7730ea00ea64dc7cbaba
block: fix ioprio_get(IOPRIO_WHO_PGRP) vs setuid(2)

do_each_pid_thread(PIDTYPE_PGID) can race with a concurrent
change_pid(PIDTYPE_PGID) that can move the task from one hlist
to another while iterating. Serialize ioprio_get to take
the tasklist_lock in this case, just like it's set counterpart.

Fixes: 341e656ff2f (ioprio: grab rcu_read_lock in sys_ioprio_{set,get}())
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Link: https://lore.kernel.org/r/20211210182058.43417-1-dave@stgolabs.net
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/ioprio.c