diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-06-03 15:37:53 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-06-16 11:55:01 +0200 |
commit | 4b380a7d84ef2ce3f4f5bec5d8706ed937ac6502 (patch) | |
tree | 8b9b925c957077421793f1f48cebdeba431ee486 /fs | |
parent | 1ec2dcd680c71d0d36fa25638b327a468babd5c9 (diff) | |
download | linux-stable-4b380a7d84ef2ce3f4f5bec5d8706ed937ac6502.tar.gz linux-stable-4b380a7d84ef2ce3f4f5bec5d8706ed937ac6502.tar.bz2 linux-stable-4b380a7d84ef2ce3f4f5bec5d8706ed937ac6502.zip |
NFS: Fix a potential NULL dereference in nfs_get_client()
[ Upstream commit 09226e8303beeec10f2ff844d2e46d1371dc58e0 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
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 07c5ddd5d6d5..78b6f8bc9d76 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -407,7 +407,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 */ |