• faux123's avatar
    tmpfs: fix mempolicy object leaks · 05d4643a
    faux123 authored
    
    
    This patch fixes several mempolicy leaks in the tmpfs mount logic.
    These leaks are slow - on the order of one object leaked per mount
    attempt.
    
    Leak 1 (umount doesn't free mpol allocated in mount):
        while true; do
            mount -t tmpfs -o mpol=interleave,size=100M nodev /mnt
            umount /mnt
        done
    
    Leak 2 (errors parsing remount options will leak mpol):
        mount -t tmpfs -o size=100M nodev /mnt
        while true; do
            mount -o remount,mpol=interleave,size=x /mnt 2> /dev/null
        done
        umount /mnt
    
    Leak 3 (multiple mpol per mount leak mpol):
        while true; do
            mount -t tmpfs -o mpol=interleave,mpol=interleave,size=100M nodev /mnt
            umount /mnt
        done
    
    This patch fixes all of the above.  I could have broken the patch into
    three pieces but is seemed easier to review as one.
    Signed-off-by: default avatarGreg Thelen <gthelen@google.com>
    modified for Mako kernel from LKML reference
    Signed-off-by: default avatarfaux123 <reioux@gmail.com>
    05d4643a
shmem.c 66.1 KB