linux-stable/fs/ecryptfs
Al Viro 2d2d3f1ee7 do d_instantiate/unlock_new_inode combinations safely
commit 1e2e547a93 upstream.

For anything NFS-exported we do _not_ want to unlock new inode
before it has grown an alias; original set of fixes got the
ordering right, but missed the nasty complication in case of
lockdep being enabled - unlock_new_inode() does
	lockdep_annotate_inode_mutex_key(inode)
which can only be done before anyone gets a chance to touch
->i_mutex.  Unfortunately, flipping the order and doing
unlock_new_inode() before d_instantiate() opens a window when
mkdir can race with open-by-fhandle on a guessed fhandle, leading
to multiple aliases for a directory inode and all the breakage
that follows from that.

	Correct solution: a new primitive (d_instantiate_new())
combining these two in the right order - lockdep annotate, then
d_instantiate(), then the rest of unlock_new_inode().  All
combinations of d_instantiate() with unlock_new_inode() should
be converted to that.

Cc: stable@kernel.org	# 2.6.29 and later
Tested-by: Mike Marshall <hubcap@omnibond.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-30 07:50:16 +02:00
..
crypto.c ecryptfs: fix spelling mistakes 2016-06-20 10:02:35 -05:00
debug.c
dentry.c eCryptfs: Invalidate dcache entries when lower i_nlink is zero 2015-08-18 17:29:48 -05:00
ecryptfs_kernel.h ecryptfs: fix dereference of NULL user_key_payload 2017-11-02 09:49:15 +01:00
file.c ecryptfs: don't allow mmap when the lower fs doesn't support it 2016-07-08 10:35:28 -05:00
inode.c do d_instantiate/unlock_new_inode combinations safely 2018-05-30 07:50:16 +02:00
Kconfig Minor code cleanups and new Kconfig option to disable /dev/ecryptfs 2013-03-07 12:47:24 -08:00
keystore.c ecryptfs: fix dereference of NULL user_key_payload 2017-11-02 09:49:15 +01:00
kthread.c Revert "ecryptfs: forbid opening files without mmap handler" 2016-07-07 18:47:57 -05:00
main.c ecryptfs: Switch to generic xattr handlers 2016-10-06 22:17:38 -04:00
Makefile eCryptfs: allow userspace messaging to be disabled 2013-03-03 23:59:59 -08:00
messaging.c eCryptfs: use after free in ecryptfs_release_messaging() 2017-11-30 08:39:03 +00:00
miscdev.c ecryptfs: close rmmod race 2013-04-09 14:08:16 -04:00
mmap.c xattr: Add __vfs_{get,set,remove}xattr helpers 2016-10-07 20:10:44 -04:00
read_write.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
super.c eCryptfs: Do not allocate hash tfm in NORECLAIM context 2016-04-20 17:50:01 +08:00