• Miklos Szeredi's avatar
    ovl: check whiteout in ovl_create_over_whiteout() · cd09665a
    Miklos Szeredi authored
    commit 5e127580 upstream.
    
    Kaixuxia repors that it's possible to crash overlayfs by removing the
    whiteout on the upper layer before creating a directory over it.  This is a
    reproducer:
    
     mkdir lower upper work merge
     touch lower/file
     mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merge
     rm merge/file
     ls -al merge/file
     rm upper/file
     ls -al merge/
     mkdir merge/file
    
    Before commencing with a vfs_rename(..., RENAME_EXCHANGE) verify that the
    lookup of "upper" is positive and is a whiteout, and return ESTALE
    otherwise.
    
    Reported by: kaixuxia <xiakaixu1987@gmail.com>
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
    Fixes: e9be9d5e ("overlay filesystem")
    Cc: <stable@vger.kernel.org> # v3.18
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    cd09665a
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
copy_up.c Loading commit data...
dir.c Loading commit data...
inode.c Loading commit data...
namei.c Loading commit data...
overlayfs.h Loading commit data...
ovl_entry.h Loading commit data...
readdir.c Loading commit data...
super.c Loading commit data...
util.c Loading commit data...