Re: [PATCH 2/2] 9p: destroy client in symmetric order

From: Leon Romanovsky
Date: Thu Sep 29 2022 - 06:53:41 EST


On Thu, Sep 29, 2022 at 07:29:33PM +0900, Dominique Martinet wrote:
> Leon Romanovsky wrote on Thu, Sep 29, 2022 at 12:37:56PM +0300:
> > Make sure that all variables are initialized and released in correct
> > order.
>
> Haven't tried running or compiling, comments out of my head that might
> be wrong below
>
> >
> > Reported-by: syzbot+de52531662ebb8823b26@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> You're adding this report tag but I don't see how you fix that failure.
> What you need is p9_tag_cleanup(clnt) from p9_client_destroy -- I assume
> this isn't possible for any fid to be allocated at this point so the fid
> destroying loop is -probably- optional.
>
> I would assume it is needed from p9_client_version failures.
>
>
> > Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
> > ---
> > net/9p/client.c | 37 ++++++++++++-------------------------
> > 1 file changed, 12 insertions(+), 25 deletions(-)
> >
> > diff --git a/net/9p/client.c b/net/9p/client.c
> > index aaa37b07e30a..8277e33506e7 100644
> > --- a/net/9p/client.c
> > +++ b/net/9p/client.c
> > @@ -179,7 +179,6 @@ static int parse_opts(char *opts, struct p9_client *clnt)
> > goto free_and_return;
> > }
> >
> > - v9fs_put_trans(clnt->trans_mod);
>
> Pretty sure you'll be "leaking transports" if someone tries to pass
> trans=foo multiple times; this can't be removed...(continues below)...

It is pity, you are right.

Thanks