0271-fs-prevent-speculative-execution.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Elena Reshetova <[email protected]>
  3. Date: Mon, 4 Sep 2017 13:11:54 +0300
  4. Subject: [PATCH] fs: prevent speculative execution
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. CVE-2017-5753
  9. CVE-2017-5715
  10. Real commit text tbd
  11. Signed-off-by: Elena Reshetova <[email protected]>
  12. Signed-off-by: Tim Chen <[email protected]>
  13. Signed-off-by: Andy Whitcroft <[email protected]>
  14. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  15. (cherry picked from commit 1ca9e14b253a501f055c3ea29d992c028473676e)
  16. Signed-off-by: Fabian Grünbichler <[email protected]>
  17. ---
  18. include/linux/fdtable.h | 4 +++-
  19. 1 file changed, 3 insertions(+), 1 deletion(-)
  20. diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
  21. index 6e84b2cae6ad..09b124542bb8 100644
  22. --- a/include/linux/fdtable.h
  23. +++ b/include/linux/fdtable.h
  24. @@ -81,8 +81,10 @@ static inline struct file *__fcheck_files(struct files_struct *files, unsigned i
  25. {
  26. struct fdtable *fdt = rcu_dereference_raw(files->fdt);
  27. - if (fd < fdt->max_fds)
  28. + if (fd < fdt->max_fds) {
  29. + gmb();
  30. return rcu_dereference_raw(fdt->fd[fd]);
  31. + }
  32. return NULL;
  33. }
  34. --
  35. 2.14.2