eCryptfs: Prevent file create race condition
authorTyler Hicks <tyhicks@canonical.com>
Mon, 21 Nov 2011 23:31:02 +0000 (17:31 -0600)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Dec 2011 16:54:04 +0000 (08:54 -0800)
commitd1d274cd1ce2eb979c66233a36a7a92abfc0f18f
treeda8e894566fc1f86770f4301865c6197f05ad4e1
parent74517cb61ec5b7b5902b36feb0ae2cc60444e8f0
eCryptfs: Prevent file create race condition

commit b59db43ad4434519feb338eacb01d77eb50825c5 upstream.

The file creation path prematurely called d_instantiate() and
unlock_new_inode() before the eCryptfs inode info was fully
allocated and initialized and before the eCryptfs metadata was written
to the lower file.

This could result in race conditions in subsequent file and inode
operations leading to unexpected error conditions or a null pointer
dereference while attempting to use the unallocated memory.

https://launchpad.net/bugs/813146

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ecryptfs/crypto.c
fs/ecryptfs/ecryptfs_kernel.h
fs/ecryptfs/inode.c