提交 ce510193 编写于 作者: J Josh Triplett 提交者: Trond Myklebust

NFS: Release dcache_lock in an error path of nfs_path

In one of the error paths of nfs_path, it may return with dcache_lock still
held; fix this by adding and using a new error path Elong_unlock which unlocks
dcache_lock.
Signed-off-by: NJosh Triplett <josh@freedesktop.org>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
(cherry picked from f4b90b43677fb23297c56802c3056fc304f988d9 commit)
上级 3f2792ff
...@@ -51,7 +51,7 @@ char *nfs_path(const char *base, const struct dentry *dentry, ...@@ -51,7 +51,7 @@ char *nfs_path(const char *base, const struct dentry *dentry,
namelen = dentry->d_name.len; namelen = dentry->d_name.len;
buflen -= namelen + 1; buflen -= namelen + 1;
if (buflen < 0) if (buflen < 0)
goto Elong; goto Elong_unlock;
end -= namelen; end -= namelen;
memcpy(end, dentry->d_name.name, namelen); memcpy(end, dentry->d_name.name, namelen);
*--end = '/'; *--end = '/';
...@@ -68,6 +68,8 @@ char *nfs_path(const char *base, const struct dentry *dentry, ...@@ -68,6 +68,8 @@ char *nfs_path(const char *base, const struct dentry *dentry,
end -= namelen; end -= namelen;
memcpy(end, base, namelen); memcpy(end, base, namelen);
return end; return end;
Elong_unlock:
spin_unlock(&dcache_lock);
Elong: Elong:
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册