Re: [PATCH 03/06] 9p: v9fs_fid_lookup_with_uid fix's fix suggestion

Tyler Hicks
2022-06-13T20:52:10Z

On 2022-06-12 17:53:26, Dominique Martinet wrote:
> Tyler, I can just squash this in your commit if you're ok with this,
> as I've already rebased the other patches on top of it.

Yes, that is fine. I've also tested this with my (binary-only)
reproducer and it works as expected.

Thanks!

Tyler

>
> Cc: Tyler Hicks <tyhicks@linux.microsoft.com>
> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
> ---
> fs/9p/fid.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/9p/fid.c b/fs/9p/fid.c
> index 5a469b79c1ee..baf2b152229e 100644
> --- a/fs/9p/fid.c
> +++ b/fs/9p/fid.c
> @@ -221,12 +221,15 @@ static struct p9_fid *v9fs_fid_lookup_with_uid(struct dentry *dentry,
> * walk to ensure none of the patch component change
> */
> fid = p9_client_walk(fid, l, &wnames[i], clone);
> - p9_client_clunk(old_fid);
> + /* non-cloning walk will return the same fid */
> + if (fid != old_fid) {
> + p9_client_clunk(old_fid);
> + old_fid = fid;
> + }
> if (IS_ERR(fid)) {
> kfree(wnames);
> goto err_out;
> }
> - old_fid = fid;
> i += l;
> clone = 0;
> }
> --
> 2.35.1
>