mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-22 20:30:58 +02:00
fs: prevent out-of-bounds array speculation when closing a file descriptor
Google-Bug-Id: 114199369 Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -642,6 +642,7 @@ static struct file *pick_file(struct files_struct *files, unsigned fd)
|
|||||||
if (fd >= fdt->max_fds)
|
if (fd >= fdt->max_fds)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
fd = array_index_nospec(fd, fdt->max_fds);
|
||||||
file = fdt->fd[fd];
|
file = fdt->fd[fd];
|
||||||
if (file) {
|
if (file) {
|
||||||
rcu_assign_pointer(fdt->fd[fd], NULL);
|
rcu_assign_pointer(fdt->fd[fd], NULL);
|
||||||
|
Reference in New Issue
Block a user