linux-brain/fs/configfs
Al Viro 5e36cf8edb configfs: fix a deadlock in configfs_symlink()
commit 351e5d869e upstream.

Configfs abuses symlink(2).  Unlike the normal filesystems, it
wants the target resolved at symlink(2) time, like link(2) would've
done.  The problem is that ->symlink() is called with the parent
directory locked exclusive, so resolving the target inside the
->symlink() is easily deadlocked.

Short of really ugly games in sys_symlink() itself, all we can
do is to unlock the parent before resolving the target and
relock it after.  However, that invalidates the checks done
by the caller of ->symlink(), so we have to
	* check that dentry is still where it used to be
(it couldn't have been moved, but it could've been unhashed)
	* recheck that it's still negative (somebody else
might've successfully created a symlink with the same name
while we were looking the target up)
	* recheck the permissions on the parent directory.

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-12 19:20:47 +01:00
..
configfs_internal.h configfs: new object reprsenting tree fragments 2019-11-12 19:20:46 +01:00
dir.c configfs: provide exclusion between IO and removals 2019-11-12 19:20:47 +01:00
file.c configfs: provide exclusion between IO and removals 2019-11-12 19:20:47 +01:00
inode.c vfs: change inode times to use struct timespec64 2018-06-05 16:57:31 -07:00
item.c configfs: use kvasprintf() instead of open-coding it 2018-06-19 07:08:12 +02:00
Kconfig configfs: change depends -> select SYSFS 2011-01-16 21:22:29 +00:00
Makefile [PATCH] configfs: User-driven configuration filesystem 2006-01-03 11:45:28 -08:00
mount.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
symlink.c configfs: fix a deadlock in configfs_symlink() 2019-11-12 19:20:47 +01:00