]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid
authorJens Axboe <axboe@kernel.dk>
Sat, 21 Oct 2023 18:30:29 +0000 (12:30 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 16:56:36 +0000 (16:56 +0000)
commit3d7912710e5e187217313fea5c145881cfeaf952
tree80e05e835aa15d55c1679ac0ae3d045cec015ec8
parent595b051c83a1374b1d53ab44de1c27ac60b95979
io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid

commit 7644b1a1c9a7ae8ab99175989bfc8676055edb46 upstream.

We could race with SQ thread exit, and if we do, we'll hit a NULL pointer
dereference when the thread is cleared. Grab the SQPOLL data lock before
attempting to get the task cpu and pid for fdinfo, this ensures we have a
stable view of it.

Cc: stable@vger.kernel.org
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218032
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: He Gao <hegao@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/io_uring.c