lkml.org 
[lkml]   [2022]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/06] 9p: fix fid refcount leak in v9fs_vfs_get_link
On 2022-06-12 17:53:25, Dominique Martinet wrote:
> we check for protocol version later than required, after a fid has
> been obtained. Just move the version check earlier.
>
> Fixes: 6636b6dcc3db ("9p: add refcount to p9_fid struct")
> Cc: stable@vger.kernel.org

Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>

Tyler

> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
> ---
> fs/9p/vfs_inode.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
> index 55367ecb9442..18c780ffd4b5 100644
> --- a/fs/9p/vfs_inode.c
> +++ b/fs/9p/vfs_inode.c
> @@ -1250,15 +1250,15 @@ static const char *v9fs_vfs_get_link(struct dentry *dentry,
> return ERR_PTR(-ECHILD);
>
> 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);
> + fid = v9fs_fid_lookup(dentry);
>
> if (IS_ERR(fid))
> return ERR_CAST(fid);
>
> - if (!v9fs_proto_dotu(v9ses))
> - return ERR_PTR(-EBADF);
> -
> st = p9_client_stat(fid);
> p9_client_clunk(fid);
> if (IS_ERR(st))
> --
> 2.35.1
>

\
 
 \ /
  Last update: 2022-06-13 21:02    [W:0.171 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site