diff options
author | Christoph Hellwig <hch@lst.de> | 2022-05-18 10:40:05 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-05-18 06:19:05 -0600 |
commit | 0bf1dbee9baf3e78bff297245178f8c9a8ef8670 (patch) | |
tree | 898d5a1894fad9623a40b4fbedb41db1ee90223a /fs/io_uring.c | |
parent | a294bef57c55a45aef51d31e71d6892e8eba1483 (diff) |
io_uring: use rcu_dereference in io_close
Accessing the file table needs a rcu_dereference_protected().
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220518084005.3255380-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index e24eb20f7e30..7b27afdab0e6 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5372,7 +5372,8 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags) spin_unlock(&files->file_lock); goto err; } - file = fdt->fd[close->fd]; + file = rcu_dereference_protected(fdt->fd[close->fd], + lockdep_is_held(&files->file_lock)); if (!file || file->f_op == &io_uring_fops) { spin_unlock(&files->file_lock); file = NULL; |