diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-08-03 11:51:18 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2019-09-11 12:45:49 +0200 |
commit | 351e5d869e5ac10cb40c78b5f2d7dfc816ad4587 (patch) | |
tree | bbff139362c2d49c1bfff6a843c7e32cfd32902b /fs/configfs/dir.c | |
parent | f74c2bb98776e2de508f4d607cd519873065118e (diff) | |
download | linux-stable-351e5d869e5ac10cb40c78b5f2d7dfc816ad4587.tar.gz linux-stable-351e5d869e5ac10cb40c78b5f2d7dfc816ad4587.tar.bz2 linux-stable-351e5d869e5ac10cb40c78b5f2d7dfc816ad4587.zip |
configfs: fix a deadlock in configfs_symlink()
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>
Diffstat (limited to 'fs/configfs/dir.c')
0 files changed, 0 insertions, 0 deletions