linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Malahal Naineni <malahal@us.ibm.com>
To: linux-nfs@vger.kernel.org
Cc: Trond.Myklebust@netapp.com
Subject: Re: [PATCH] Check validity of cl_rpcclient in nfs_server_list_show
Date: Mon, 19 Sep 2011 08:34:29 -0700	[thread overview]
Message-ID: <20110919153429.GA16725@us.ibm.com> (raw)
In-Reply-To: <1315965305-23757-1-git-send-email-malahal@us.ibm.com>

Any comments on the patch below? It is very easy to reproduce the bug
(at least on SLES11 SP1).

Thanks, Malahal.

Malahal Naineni [malahal@us.ibm.com] wrote:
> As soon as the nfs_client gets created, its cl_rpcclient is set to
> ERR_PTR(-EINVAL). The rpc client structure is allocated later. Check
> for the validity of cl_rpcclient before using it.
> 
> Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
> ---
>  fs/nfs/client.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> index 5833fbb..ff79e72 100644
> --- a/fs/nfs/client.c
> +++ b/fs/nfs/client.c
> @@ -1867,6 +1867,10 @@ static int nfs_server_list_show(struct seq_file *m, void *v)
>  	/* display one transport per line on subsequent lines */
>  	clp = list_entry(v, struct nfs_client, cl_share_link);
> 
> +	/* Check if the rpc client is initialized */
> +	if (IS_ERR(clp->cl_rpcclient))
> +		return 0;
> +
>  	seq_printf(m, "v%u %s %s %3d %s\n",
>  		   clp->rpc_ops->version,
>  		   rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR),
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-09-19 15:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-14  1:55 [PATCH] Check validity of cl_rpcclient in nfs_server_list_show Malahal Naineni
2011-09-19 15:34 ` Malahal Naineni [this message]
2011-09-19 17:33   ` Myklebust, Trond
2011-09-21  0:27     ` Malahal Naineni
2011-09-27 16:43       ` Malahal Naineni
2011-10-12 17:17         ` Malahal Naineni
2011-10-20 17:19           ` Malahal Naineni
  -- strict thread matches above, loose matches on Subject: below --
2011-10-20 19:03 Myklebust, Trond

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=20110919153429.GA16725@us.ibm.com \
    --to=malahal@us.ibm.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /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).