diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-06-03 14:37:53 +0200 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2021-06-03 16:14:42 +0200 |
commit | 09226e8303beeec10f2ff844d2e46d1371dc58e0 (patch) | |
tree | 51e2c230c7399abae13d4cad9d123ca1d256b99d /fs | |
parent | NFS: Fix use-after-free in nfs4_init_client() (diff) | |
download | linux-09226e8303beeec10f2ff844d2e46d1371dc58e0.tar.xz linux-09226e8303beeec10f2ff844d2e46d1371dc58e0.zip |
NFS: Fix a potential NULL dereference in nfs_get_client()
None of the callers are expecting NULL returns from nfs_get_client() so
this code will lead to an Oops. It's better to return an error
pointer. I expect that this is dead code so hopefully no one is
affected.
Fixes: 31434f496abb ("nfs: check hostname in nfs_get_client")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/client.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index cfeaadf56bf0..330f65727c45 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -406,7 +406,7 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init) if (cl_init->hostname == NULL) { WARN_ON(1); - return NULL; + return ERR_PTR(-EINVAL); } /* see if the client already exists */ |