diff options
author | Theodore Ts'o <tytso@mit.edu> | 2023-03-06 21:54:50 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-17 10:45:05 +0300 |
commit | a759905de9cd6ec9ca08ceadf0920272772ed830 (patch) | |
tree | 95e886c4922569a868d888bc63e9b17560aa7af6 /fs | |
parent | 955623617f2f505ac08d0efda2bb50c1a52e2c96 (diff) | |
download | linux-a759905de9cd6ec9ca08ceadf0920272772ed830.tar.xz |
fs: prevent out-of-bounds array speculation when closing a file descriptor
commit 609d54441493c99f21c1823dfd66fa7f4c512ff4 upstream.
Google-Bug-Id: 114199369
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/file.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/file.c b/fs/file.c index 97a0cd31faec..173d318208b8 100644 --- a/fs/file.c +++ b/fs/file.c @@ -677,6 +677,7 @@ static struct file *pick_file(struct files_struct *files, unsigned fd) fdt = files_fdtable(files); if (fd >= fdt->max_fds) goto out_unlock; + fd = array_index_nospec(fd, fdt->max_fds); file = fdt->fd[fd]; if (!file) goto out_unlock; |