Skip to content

Commit

Permalink
Check validity of cl_rpcclient in nfs_server_list_show
Browse files Browse the repository at this point in the history
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
if the client is ready before using the cl_rpcclient pointer.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Malahal Naineni authored and Trond Myklebust committed Oct 20, 2011
1 parent b6ee8cd commit 940aab4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,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 client is initialized */
if (clp->cl_cons_state != NFS_CS_READY)
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),
Expand Down

0 comments on commit 940aab4

Please sign in to comment.