linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: prevent out-of-bounds array speculation when closing a file descriptor
@ 2020-07-23 18:59 Theodore Ts'o
  2020-07-24  1:18 ` Sedat Dilek
  0 siblings, 1 reply; 5+ messages in thread
From: Theodore Ts'o @ 2020-07-23 18:59 UTC (permalink / raw)
  To: viro; +Cc: Linux Filesystem Development List, Theodore Ts'o

Google-Bug-Id: 114199369
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/file.c b/fs/file.c
index abb8b7081d7a..73189eaad1df 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -632,6 +632,7 @@ int __close_fd(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;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-13 20:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-23 18:59 [PATCH] fs: prevent out-of-bounds array speculation when closing a file descriptor Theodore Ts'o
2020-07-24  1:18 ` Sedat Dilek
2021-01-08 12:59   ` Sedat Dilek
2021-04-08 12:15     ` Sedat Dilek
2023-03-13 20:34       ` Sedat Dilek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).