summaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-14 16:39:47 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-14 16:39:47 +0100
commitb7d91c915290ab0bfbab84a0fb9c9eae57816982 (patch)
tree75c1d0e53e297f6bd1eae2c04ed463a8f603b5cd /mm/swapfile.c
parentf2ed287bcc9073d8edbf6561c389b282163edc78 (diff)
parenta25f0944ba9b1d8a6813fd6f1a86f1bd59ac25a6 (diff)
downloadlinux-b7d91c915290ab0bfbab84a0fb9c9eae57816982.tar.gz
linux-b7d91c915290ab0bfbab84a0fb9c9eae57816982.tar.bz2
linux-b7d91c915290ab0bfbab84a0fb9c9eae57816982.zip
Merge 4.9-rc5 into char-misc-next
We want those fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 2210de290b54..f30438970cd1 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2224,6 +2224,8 @@ static unsigned long read_swap_header(struct swap_info_struct *p,
swab32s(&swap_header->info.version);
swab32s(&swap_header->info.last_page);
swab32s(&swap_header->info.nr_badpages);
+ if (swap_header->info.nr_badpages > MAX_SWAP_BADPAGES)
+ return 0;
for (i = 0; i < swap_header->info.nr_badpages; i++)
swab32s(&swap_header->info.badpages[i]);
}