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:32:47 +0300 |
commit | 6631c8da02cfad96c53b217cf647b511c7f34faf (patch) | |
tree | 90d02f821db49d800e19066253cb25c349d94acc /fs | |
parent | b829e8b6e1a7bb8cd3042b927113a22fed0b0d47 (diff) | |
download | linux-6631c8da02cfad96c53b217cf647b511c7f34faf.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 51f53a7dc221..e56059fa1b30 100644 --- a/fs/file.c +++ b/fs/file.c @@ -654,6 +654,7 @@ int __close_fd_get_file(unsigned int fd, struct file **res) 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; |