Skip to content

Commit 09226e8

Browse files
Dan CarpenterTrond Myklebust
authored andcommitted
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: 31434f4 ("nfs: check hostname in nfs_get_client") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 476bdb0 commit 09226e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/nfs/client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init)
406406

407407
if (cl_init->hostname == NULL) {
408408
WARN_ON(1);
409-
return NULL;
409+
return ERR_PTR(-EINVAL);
410410
}
411411

412412
/* see if the client already exists */

0 commit comments

Comments
 (0)