From: Zijun Hu quic_zijuhu@quicinc.com
configfs_symlink() returns -EEXIST under condition d_unhashed(), but the condition often means the dentry does not exist.
Fix by changing the condition to !d_unhashed().
Fixes: 351e5d869e5a ("configfs: fix a deadlock in configfs_symlink()") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu quic_zijuhu@quicinc.com --- fs/configfs/symlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index 69133ec1fac2a854241c2a08a3b48c4c2e8d5c24..cccf61fb8317d739643834e1810b7f136058f56c 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c @@ -193,7 +193,7 @@ int configfs_symlink(struct mnt_idmap *idmap, struct inode *dir, if (ret) goto out_put;
- if (dentry->d_inode || d_unhashed(dentry)) + if (dentry->d_inode || !d_unhashed(dentry)) ret = -EEXIST; else ret = inode_permission(&nop_mnt_idmap, dir,