From 1c5d9bc346d741c6ce477798384b3080923819c2 Mon Sep 17 00:00:00 2001 From: David Mosberger Date: Tue, 15 Apr 2003 21:20:26 -0700 Subject: [PATCH] [PATCH] fix fs->lock deadlock with emulated name lookup The patch below is needed to avoid a deadlock on fs->lock. Without the patch, if __emul_lookup_dentry() returns 0, we fail to reacquire current->fs->lock and then go ahead to read_unlock() it anyhow. Bad for your health. I believe the bug was introduced when the fast pathwalk was reverted in order to introduce the RCU lockless path walking. --- fs/namei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/namei.c b/fs/namei.c index 5f4e5a56f1e96..93ac080e69ddc 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -847,6 +847,7 @@ int path_lookup(const char *name, unsigned int flags, struct nameidata *nd) read_unlock(¤t->fs->lock); if (__emul_lookup_dentry(name,nd)) return 0; + read_lock(¤t->fs->lock); } nd->mnt = mntget(current->fs->rootmnt); nd->dentry = dget(current->fs->root); -- 2.53.0