]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fix fs->lock deadlock with emulated name lookup
authorDavid Mosberger <davidm@napali.hpl.hp.com>
Wed, 16 Apr 2003 04:20:26 +0000 (21:20 -0700)
committerDavid Mosberger <davidm@napali.hpl.hp.com>
Wed, 16 Apr 2003 04:20:26 +0000 (21:20 -0700)
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

index 5f4e5a56f1e960d551a07f1f9c7117945223aaea..93ac080e69ddcd86a54168067363898368ea86c3 100644 (file)
@@ -847,6 +847,7 @@ int path_lookup(const char *name, unsigned int flags, struct nameidata *nd)
                        read_unlock(&current->fs->lock);
                        if (__emul_lookup_dentry(name,nd))
                                return 0;
+                       read_lock(&current->fs->lock);
                }
                nd->mnt = mntget(current->fs->rootmnt);
                nd->dentry = dget(current->fs->root);