netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jiangyiwen <jiangyiwen@huawei.com>
To: Chengguang Xu <cgxu519@gmx.com>, <ericvh@gmail.com>,
	<rminnich@sandia.gov>, <lucho@ionkov.net>, <davem@davemloft.net>
Cc: <v9fs-developer@lists.sourceforge.net>, <netdev@vger.kernel.org>
Subject: Re: [V9fs-developer] [PATCH] net/9p: fix potential refcnt problem of trans module
Date: Wed, 28 Mar 2018 10:10:08 +0800	[thread overview]
Message-ID: <5ABAF980.5060406@huawei.com> (raw)
In-Reply-To: <1522154942-57339-1-git-send-email-cgxu519@gmx.com>

On 2018/3/27 20:49, Chengguang Xu wrote:
> When specifying trans_mod multiple times in a mount,
> it may cause inaccurate refcount of trans module. Also,
> in the error case of option parsing, we should put the
> trans module if we have already got.
> 
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
>  net/9p/client.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/9p/client.c b/net/9p/client.c
> index b433aff..7ccfb4b 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -190,7 +190,9 @@ static int parse_opts(char *opts, struct p9_client *clnt)
>  				p9_debug(P9_DEBUG_ERROR,
>  					 "problem allocating copy of trans arg\n");
>  				goto free_and_return;
> -			 }
> +			}
> +
> +			v9fs_put_trans(clnt->trans_mod);

I think this should return error if using multiple times
in a mount.

>  			clnt->trans_mod = v9fs_get_trans_by_name(s);
>  			if (clnt->trans_mod == NULL) {
>  				pr_info("Could not find request transport: %s\n",
> @@ -226,6 +228,7 @@ static int parse_opts(char *opts, struct p9_client *clnt)
>  	}
>  
>  free_and_return:
> +	v9fs_put_trans(clnt->trans_mod);

This looks good.

>  	kfree(tmp_options);
>  	return ret;
>  }
> 

  reply	other threads:[~2018-03-28  2:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 12:49 [PATCH] net/9p: fix potential refcnt problem of trans module Chengguang Xu
2018-03-28  2:10 ` jiangyiwen [this message]
2018-03-28  2:52   ` [V9fs-developer] " cgxu519
2018-03-28  3:38     ` jiangyiwen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ABAF980.5060406@huawei.com \
    --to=jiangyiwen@huawei.com \
    --cc=cgxu519@gmx.com \
    --cc=davem@davemloft.net \
    --cc=ericvh@gmail.com \
    --cc=lucho@ionkov.net \
    --cc=netdev@vger.kernel.org \
    --cc=rminnich@sandia.gov \
    --cc=v9fs-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).