android_kernel_google_msm/include
Mel Gorman 78a685beb0 tmpfs: fix shared mempolicy leak
commit 18a2f371f5 upstream.

This fixes a regression in 3.7-rc, which has since gone into stable.

Commit 00442ad04a ("mempolicy: fix a memory corruption by refcount
imbalance in alloc_pages_vma()") changed get_vma_policy() to raise the
refcount on a shmem shared mempolicy; whereas shmem_alloc_page() went
on expecting alloc_page_vma() to drop the refcount it had acquired.
This deserves a rework: but for now fix the leak in shmem_alloc_page().

Hugh: shmem_swapin() did not need a fix, but surely it's clearer to use
the same refcounting there as in shmem_alloc_page(), delete its onstack
mempolicy, and the strange mpol_cond_copy() and __mpol_cond_copy() -
those were invented to let swapin_readahead() make an unknown number of
calls to alloc_pages_vma() with one mempolicy; but since 00442ad04a,
alloc_pages_vma() has kept refcount in balance, so now no problem.

Reported-and-tested-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-12-17 10:37:42 -08:00
..
acpi Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux 2012-05-05 10:06:06 -07:00
asm-generic mutex: Place lock in contended state after fastpath_lock failure 2012-10-02 10:30:21 -07:00
crypto
drm drm/radeon: add new SI pci id 2012-12-03 11:47:01 -08:00
keys
linux tmpfs: fix shared mempolicy leak 2012-12-17 10:37:42 -08:00
math-emu
media Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2012-05-14 11:23:37 -07:00
misc
mtd
net mac80211: verify that skb data is present 2012-11-17 13:16:11 -08:00
pcmcia
rdma infiniband: pass rdma_cm module to netlink_dump_start 2012-10-28 10:14:15 -07:00
rxrpc
scsi SCSI: libsas: fix taskfile corruption in sas_ata_qc_fill_rtf 2012-07-16 09:04:37 -07:00
sound ALSA: Add a reference counter to card instance 2012-11-17 13:16:13 -08:00
target target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE 2012-08-09 08:31:26 -07:00
trace xen/mmu: Use Xen specific TLB flush instead of the generic one. 2012-11-17 13:15:54 -08:00
video
xen xen/m2p: do not reuse kmap_op->dev_bus_addr 2012-10-02 10:30:06 -07:00
Kbuild