]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
mm: prevent get_user_pages() from overflowing page refcount
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Apr 2019 17:49:19 +0000 (10:49 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commita991ca8f7a3d3867a226bc94139ebccf8d52fa8c
treea9915d813122be049bbb96398576abb4d58bdc5d
parent16748b28f83dad114f02c23dd0de697ac8f7d8a6
mm: prevent get_user_pages() from overflowing page refcount

BugLink: https://bugs.launchpad.net/bugs/1838459
commit 8fde12ca79aff9b5ba951fce1a2641901b8d8e64 upstream.

If the page refcount wraps around past zero, it will be freed while
there are still four billion references to it.  One of the possible
avenues for an attacker to try to make this happen is by doing direct IO
on a page multiple times.  This patch makes get_user_pages() refuse to
take a new page reference if there are already more than two billion
references to the page.

Reported-by: Jann Horn <jannh@google.com>
Acked-by: Matthew Wilcox <willy@infradead.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
mm/gup.c
mm/hugetlb.c