]> git.baikalelectronics.ru Git - kernel.git/commit
usercopy: Make usercopy resilient against ridiculously large copies
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 12 Jun 2022 21:32:27 +0000 (22:32 +0100)
committerKees Cook <keescook@chromium.org>
Mon, 13 Jun 2022 16:54:52 +0000 (09:54 -0700)
commit8a1a4b8ada7aaa3bc14a651a43e6099076c4c574
tree5d113acb38d1b7af478d04036fc46d55134c578b
parent19dee1d49e728beab95efaac3eb4dc6117eb3ed9
usercopy: Make usercopy resilient against ridiculously large copies

If 'n' is so large that it's negative, we might wrap around and mistakenly
think that the copy is OK when it's not.  Such a copy would probably
crash, but just doing the arithmetic in a more simple way lets us detect
and refuse this case.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220612213227.3881769-4-willy@infradead.org
mm/usercopy.c