linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfsd: fix an IS_ERR() vs NULL check
@ 2019-01-04  6:47 Dan Carpenter
  2019-01-04 15:03 ` J. Bruce Fields
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-01-04  6:47 UTC (permalink / raw)
  To: J. Bruce Fields, NeilBrown; +Cc: Jeff Layton, linux-nfs, kernel-janitors

The get_backchannel_cred() used to return error pointers on error but
now it returns NULL pointers.

Fixes: 97f68c6b02e0 ("SUNRPC: add 'struct cred *' to auth_cred and rpc_cre")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/nfsd/nfs4callback.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index c74e4538d0eb..9b38dab1c21b 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -913,9 +913,9 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
 		return PTR_ERR(client);
 	}
 	cred = get_backchannel_cred(clp, client, ses);
-	if (IS_ERR(cred)) {
+	if (!cred) {
 		rpc_shutdown_client(client);
-		return PTR_ERR(cred);
+		return -ENOMEM;
 	}
 	clp->cl_cb_client = client;
 	clp->cl_cb_cred = cred;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nfsd: fix an IS_ERR() vs NULL check
  2019-01-04  6:47 [PATCH] nfsd: fix an IS_ERR() vs NULL check Dan Carpenter
@ 2019-01-04 15:03 ` J. Bruce Fields
  0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2019-01-04 15:03 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: NeilBrown, Jeff Layton, linux-nfs, kernel-janitors

On Fri, Jan 04, 2019 at 09:47:03AM +0300, Dan Carpenter wrote:
> The get_backchannel_cred() used to return error pointers on error but
> now it returns NULL pointers.

Thanks!  Queueing up for 4.21 and stable.

Off the top of my head I don't recall bug reports that could be
explained by this.  Perhaps it's hard to get a failure at this point
without failing somewhere earlier?  But I think it's likely possible to
trigger a NULL dereference somehow.

--b.

> 
> Fixes: 97f68c6b02e0 ("SUNRPC: add 'struct cred *' to auth_cred and rpc_cre")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  fs/nfsd/nfs4callback.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
> index c74e4538d0eb..9b38dab1c21b 100644
> --- a/fs/nfsd/nfs4callback.c
> +++ b/fs/nfsd/nfs4callback.c
> @@ -913,9 +913,9 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
>  		return PTR_ERR(client);
>  	}
>  	cred = get_backchannel_cred(clp, client, ses);
> -	if (IS_ERR(cred)) {
> +	if (!cred) {
>  		rpc_shutdown_client(client);
> -		return PTR_ERR(cred);
> +		return -ENOMEM;
>  	}
>  	clp->cl_cb_client = client;
>  	clp->cl_cb_cred = cred;
> -- 
> 2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-04 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04  6:47 [PATCH] nfsd: fix an IS_ERR() vs NULL check Dan Carpenter
2019-01-04 15:03 ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).