This is a note to let you know that I've just added the patch titled mm/vmpressure.c: fix race in vmpressure_work_fn() to the 3.17-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mm-vmpressure.c-fix-race-in-vmpressure_work_fn.patch and it can be found in the queue-3.17 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 91b57191cfd152c02ded0745250167d0263084f8 Mon Sep 17 00:00:00 2001 From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 2 Dec 2014 15:59:28 -0800 Subject: mm/vmpressure.c: fix race in vmpressure_work_fn() From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> commit 91b57191cfd152c02ded0745250167d0263084f8 upstream. In some android devices, there will be a "divide by zero" exception. vmpr->scanned could be zero before spin_lock(&vmpr->sr_lock). Addresses https://bugzilla.kernel.org/show_bug.cgi?id=88051 [akpm@xxxxxxxxxxxxxxxxxxxx: neaten] Reported-by: ji_ang <ji_ang@xxxxxxx> Cc: Anton Vorontsov <anton.vorontsov@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- mm/vmpressure.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -165,6 +165,7 @@ static void vmpressure_work_fn(struct wo unsigned long scanned; unsigned long reclaimed; + spin_lock(&vmpr->sr_lock); /* * Several contexts might be calling vmpressure(), so it is * possible that the work was rescheduled again before the old @@ -173,11 +174,12 @@ static void vmpressure_work_fn(struct wo * here. No need for any locks here since we don't care if * vmpr->reclaimed is in sync. */ - if (!vmpr->scanned) + scanned = vmpr->scanned; + if (!scanned) { + spin_unlock(&vmpr->sr_lock); return; + } - spin_lock(&vmpr->sr_lock); - scanned = vmpr->scanned; reclaimed = vmpr->reclaimed; vmpr->scanned = 0; vmpr->reclaimed = 0; Patches currently in stable-queue which might be from akpm@xxxxxxxxxxxxxxxxxxxx are queue-3.17/mm-vmpressure.c-fix-race-in-vmpressure_work_fn.patch queue-3.17/mm-fix-swapoff-hang-after-page-migration-and-fork.patch queue-3.17/slab-fix-nodeid-bounds-check-for-non-contiguous-node-ids.patch queue-3.17/mm-frontswap-invalidate-expired-data-on-a-dup-store-failure.patch queue-3.17/drivers-input-evdev.c-don-t-kfree-a-vmalloc-address.patch queue-3.17/mm-fix-anon_vma_clone-error-treatment.patch queue-3.17/fat-fix-oops-on-corrupted-vfat-fs.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html