Commit e5690f26 authored by Dominique Martinet's avatar Dominique Martinet

9p: fix fid refcount leak in v9fs_vfs_get_link

we check for protocol version later than required, after a fid has
been obtained. Just move the version check earlier.

Link: https://lkml.kernel.org/r/20220612085330.1451496-3-asmadeus@codewreck.org
Fixes: 6636b6dc ("9p: add refcount to p9_fid struct")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: default avatarChristian Schoenebeck <linux_oss@crudebyte.com>
Signed-off-by: default avatarDominique Martinet <asmadeus@codewreck.org>
parent beca774f
...@@ -1251,15 +1251,15 @@ static const char *v9fs_vfs_get_link(struct dentry *dentry, ...@@ -1251,15 +1251,15 @@ static const char *v9fs_vfs_get_link(struct dentry *dentry,
return ERR_PTR(-ECHILD); return ERR_PTR(-ECHILD);
v9ses = v9fs_dentry2v9ses(dentry); v9ses = v9fs_dentry2v9ses(dentry);
fid = v9fs_fid_lookup(dentry); if (!v9fs_proto_dotu(v9ses))
return ERR_PTR(-EBADF);
p9_debug(P9_DEBUG_VFS, "%pd\n", dentry); p9_debug(P9_DEBUG_VFS, "%pd\n", dentry);
fid = v9fs_fid_lookup(dentry);
if (IS_ERR(fid)) if (IS_ERR(fid))
return ERR_CAST(fid); return ERR_CAST(fid);
if (!v9fs_proto_dotu(v9ses))
return ERR_PTR(-EBADF);
st = p9_client_stat(fid); st = p9_client_stat(fid);
p9_client_clunk(fid); p9_client_clunk(fid);
if (IS_ERR(st)) if (IS_ERR(st))
......
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