diff options
Diffstat (limited to 'kernel/mm/swapfile.c')
-rw-r--r-- | kernel/mm/swapfile.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/mm/swapfile.c b/kernel/mm/swapfile.c index 58877312c..c1a0f3dea 100644 --- a/kernel/mm/swapfile.c +++ b/kernel/mm/swapfile.c @@ -2225,6 +2225,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]); } |