nvme-ioctl: move capable() admin check to the end
authorKeith Busch <kbusch@kernel.org>
Tue, 2 May 2023 18:43:41 +0000 (11:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Jan 2024 10:51:41 +0000 (11:51 +0100)
commit8b2a6a3692e2c0b06125741181fda9aa8a7f3a49
tree6bafc62ba1e81f6f44341e1a93009fbe8be4e43d
parent8884a56d2154365e2f51b74a174f23501c6fe97e
nvme-ioctl: move capable() admin check to the end

[ Upstream commit 7be866b1cf0bf1dfa74480fe8097daeceda68622 ]

This can be an expensive call on some kernel configs. Move it to the end
after checking the cheaper ways to determine if the command is allowed.

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/ioctl.c