linux-brain/fs/ecryptfs
Al Viro 03bb758894 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:48:52 +02:00
..
Kconfig Minor code cleanups and new Kconfig option to disable /dev/ecryptfs 2013-03-07 12:47:24 -08:00
Makefile eCryptfs: allow userspace messaging to be disabled 2013-03-03 23:59:59 -08:00
crypto.c eCryptfs: Delete a check before the function call "key_put" 2015-08-18 17:29:49 -05:00
debug.c eCryptfs: update comment and debug statement 2007-10-16 09:43:11 -07:00
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:40:50 +01:00
file.c ecryptfs: fix handling of directory opening 2016-09-15 08:27:47 +02:00
inode.c do d_instantiate/unlock_new_inode combinations safely 2018-05-30 07:48:52 +02:00
keystore.c ecryptfs: fix dereference of NULL user_key_payload 2017-11-02 09:40:50 +01:00
kthread.c Revert "ecryptfs: forbid opening files without mmap handler" 2016-08-10 11:49:27 +02:00
main.c VFS: normal filesystems (and lustre): d_inode() annotations 2015-04-15 15:06:57 -04:00
messaging.c eCryptfs: use after free in ecryptfs_release_messaging() 2017-11-30 08:37:20 +00:00
miscdev.c ecryptfs: close rmmod race 2013-04-09 14:08:16 -04:00
mmap.c treewide: Fix typo in printk 2015-08-07 13:58:05 +02:00
read_write.c ecryptfs: don't open-code kernel_read() 2013-05-09 13:39:58 -04:00
super.c mm + fs: store shadow entries in page cache 2014-04-03 16:21:01 -07:00