Re: [PATCH 5.12] io_uring: Convert personality_idr to XArray

From
Jens Axboe <axboe@kernel.dk>
Date
2021-03-09 20:54:50
Reply to
Pavel Begunkov, 2021-03-08
On 3/8/21 7:16 AM, Pavel Begunkov wrote:
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

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.
I applied this one yesterday, just forgot to reply here. I agree with
Matthew's optimization, though I suspect we'll have a few creds at
most and it won't make much of a difference in real life. Buffers would
likely be a lot more plentiful, so it's worth keeping in mind for
that one.

-- 
Jens Axboe
Thread (12 messages) 12 messages, 4 authors, last reply 2021-03-13
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help