linux-stable/fs/ecryptfs
Al Viro f440ea85d4 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:51:47 +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-10-12 17:16:40 +01:00
file.c ecryptfs: convert to file_write_and_wait in ->fsync 2017-08-03 14:20:22 -04:00
inode.c do d_instantiate/unlock_new_inode combinations safely 2018-05-30 07:51:47 +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-10-12 17:16:40 +01:00
kthread.c scripts/spelling.txt: add "againt" pattern and fix typo instances 2017-02-27 18:43:47 -08:00
main.c VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb) 2017-07-17 08:45:34 +01: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:40:45 +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 fs: fix kernel_write prototype 2017-09-04 19:05:15 -04:00
super.c eCryptfs: Do not allocate hash tfm in NORECLAIM context 2016-04-20 17:50:01 +08:00