NFS: Fix a potential NULL dereference in nfs_get_client()

[ Upstream commit 09226e8303 ]

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: 31434f496a ("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>
This commit is contained in:
Dan Carpenter
2021-06-03 15:37:53 +03:00
committed by Chris
parent 503084ab2c
commit 660c8bcd33

View File

@@ -379,7 +379,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init,
if (cl_init->hostname == NULL) {
WARN_ON(1);
return NULL;
return ERR_PTR(-EINVAL);
}
dprintk("--> nfs_get_client(%s,v%u)\n",