diff options
author | Peng Tao <tao.peng@primarydata.com> | 2014-07-07 23:45:48 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-07-08 14:30:03 -0400 |
commit | 31434f496abb9f3410b10f541462fe58613dd3ad (patch) | |
tree | 29c03f1c95c2db782707df4fa9d834dd9a90acde /fs | |
parent | a363e32e9459a0c5b199db9afa4b7dc143106012 (diff) |
nfs: check hostname in nfs_get_client
We reference cl_hostname in many places. Add a check to make
sure it exists.
Signed-off-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/client.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 1d09289c8f0e..b213ee8fb012 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -482,8 +482,13 @@ nfs_get_client(const struct nfs_client_initdata *cl_init, | |||
482 | struct nfs_net *nn = net_generic(cl_init->net, nfs_net_id); | 482 | struct nfs_net *nn = net_generic(cl_init->net, nfs_net_id); |
483 | const struct nfs_rpc_ops *rpc_ops = cl_init->nfs_mod->rpc_ops; | 483 | const struct nfs_rpc_ops *rpc_ops = cl_init->nfs_mod->rpc_ops; |
484 | 484 | ||
485 | if (cl_init->hostname == NULL) { | ||
486 | WARN_ON(1); | ||
487 | return NULL; | ||
488 | } | ||
489 | |||
485 | dprintk("--> nfs_get_client(%s,v%u)\n", | 490 | dprintk("--> nfs_get_client(%s,v%u)\n", |
486 | cl_init->hostname ?: "", rpc_ops->version); | 491 | cl_init->hostname, rpc_ops->version); |
487 | 492 | ||
488 | /* see if the client already exists */ | 493 | /* see if the client already exists */ |
489 | do { | 494 | do { |
@@ -510,7 +515,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init, | |||
510 | } while (!IS_ERR(new)); | 515 | } while (!IS_ERR(new)); |
511 | 516 | ||
512 | dprintk("<-- nfs_get_client() Failed to find %s (%ld)\n", | 517 | dprintk("<-- nfs_get_client() Failed to find %s (%ld)\n", |
513 | cl_init->hostname ?: "", PTR_ERR(new)); | 518 | cl_init->hostname, PTR_ERR(new)); |
514 | return new; | 519 | return new; |
515 | } | 520 | } |
516 | EXPORT_SYMBOL_GPL(nfs_get_client); | 521 | EXPORT_SYMBOL_GPL(nfs_get_client); |