Commit 1c5d9bc3 authored by David Mosberger's avatar David Mosberger

[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.
parent 8483284e
...@@ -847,6 +847,7 @@ int path_lookup(const char *name, unsigned int flags, struct nameidata *nd) ...@@ -847,6 +847,7 @@ int path_lookup(const char *name, unsigned int flags, struct nameidata *nd)
read_unlock(&current->fs->lock); read_unlock(&current->fs->lock);
if (__emul_lookup_dentry(name,nd)) if (__emul_lookup_dentry(name,nd))
return 0; return 0;
read_lock(&current->fs->lock);
} }
nd->mnt = mntget(current->fs->rootmnt); nd->mnt = mntget(current->fs->rootmnt);
nd->dentry = dget(current->fs->root); nd->dentry = dget(current->fs->root);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment