linux-stable/fs/ext2
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
..
acl.c ext2: Don't clear SGID when inheriting ACLs 2017-07-27 15:08:02 -07:00
acl.h ext2/3/4: use generic posix ACL infrastructure 2014-01-25 23:58:19 -05:00
balloc.c ext2: fix filesystem deadlock while reading corrupted xattr block 2016-07-05 22:02:41 -04:00
dir.c fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps 2016-09-27 21:06:22 -04:00
ext2.h ext2: use iomap to implement DAX 2016-09-19 11:30:29 +10:00
file.c Merge branch 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 17:11:50 -07:00
ialloc.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 20:16:43 -07:00
inode.c ext2: fix a block leak 2018-05-25 16:12:56 +02:00
ioctl.c fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps 2016-09-27 21:06:22 -04:00
Kconfig ext2: use iomap to implement DAX 2016-09-19 11:30:29 +10:00
Makefile ext2: remove xip.c and xip.h 2015-02-16 17:56:03 -08:00
namei.c do d_instantiate/unlock_new_inode combinations safely 2018-05-30 07:50:16 +02:00
super.c fs: Replace CURRENT_TIME with current_time() for inode timestamps 2016-09-27 21:06:21 -04:00
symlink.c vfs: Remove {get,set,remove}xattr inode operations 2016-10-07 21:48:36 -04:00
xattr.c fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps 2016-09-27 21:06:22 -04:00
xattr.h mbcache2: rename to mbcache 2016-02-22 22:35:22 -05:00
xattr_security.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00
xattr_trusted.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00
xattr_user.c switch xattr_handler->set() to passing dentry and inode separately 2016-05-27 15:39:43 -04:00