]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: Convert personality_idr to XArray
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 8 Mar 2021 14:16:16 +0000 (14:16 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Mar 2021 14:28:42 +0000 (07:28 -0700)
commit8ed26b87931e5812210ef9e080b92772274decf0
tree52623012243a0159fab920d43f37e696fac2cbd4
parentcde96201f60aa47b12419b077450c415c557b5be
io_uring: Convert personality_idr to XArray

You can't call idr_remove() from within a idr_for_each() callback,
but you can call xa_erase() from an xa_for_each() loop, so switch the
entire personality_idr from the IDR to the XArray.  This manifests as a
use-after-free as idr_for_each() attempts to walk the rest of the node
after removing the last entry from it.

Fixes: 1842539f27ea ("io_uring: allow registering credentials")
Cc: stable@vger.kernel.org # 5.6+
Reported-by: yangerkun <yangerkun@huawei.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
[Pavel: rebased (creds load was moved into io_init_req())]
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/7ccff36e1375f2b0ebf73d957f037b43becc0dde.1615212806.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c