eCryptfs: Prevent file create race condition
authorTyler Hicks <tyhicks@canonical.com>
Mon, 21 Nov 2011 23:31:02 +0000 (17:31 -0600)
committerTyler Hicks <tyhicks@canonical.com>
Wed, 23 Nov 2011 21:39:38 +0000 (15:39 -0600)
commitb59db43ad4434519feb338eacb01d77eb50825c5
treeee978cf1ab736b3fc104b46b2491e7742e663dcf
parent6fe4c6d466e95d31164f14b1ac4aefb51f0f4f82
eCryptfs: Prevent file create race condition

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>
Cc: stable@kernel.org
fs/ecryptfs/crypto.c
fs/ecryptfs/ecryptfs_kernel.h
fs/ecryptfs/inode.c