io_uring: fix openat/openat2 unified prep handling
authorJens Axboe <axboe@kernel.dk>
Sat, 19 Sep 2020 01:36:24 +0000 (19:36 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 15:36:30 +0000 (17:36 +0200)
commit96c45a01f4432724ffd6b95688fc5867f6025215
tree8f0a30c4113dd5fc2f7c7a0a1398c45ffb683d14
parent21aaa0fc9b940f7a48912f90ee6dffd62b9decc5
io_uring: fix openat/openat2 unified prep handling

[ Upstream commit 4eb8dded6b82e184c09bb963bea0335fa3f30b55 ]

A previous commit unified how we handle prep for these two functions,
but this means that we check the allowed context (SQPOLL, specifically)
later than we should. Move the ring type checking into the two parent
functions, instead of doing it after we've done some setup work.

Fixes: ec65fea5a8d7 ("io_uring: deduplicate io_openat{,2}_prep()")
Reported-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/io_uring.c