Thread (1 message) 1 message, 1 author, 2013-02-24

Re: [PATCH] SUNRPC: Fix possible NULL pointer dereference

From: Myklebust, Trond <hidden>
Date: 2013-02-24 22:35:08
Also in: linux-nfs

On Mon, 2013-02-25 at 03:53 +0530, Syam Sidhardhan wrote:
quoted hunk
Check for cred == NULL has to be done before accessing cred.

Signed-off-by: Syam Sidhardhan <redacted>
---
 net/sunrpc/auth.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index f529404..18678a6 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -695,10 +695,13 @@ rpcauth_invalcred(struct rpc_task *task)
 {
 	struct rpc_cred *cred = task->tk_rqstp->rq_cred;
 
+	if (cred == NULL)
+		return;
+
 	dprintk("RPC: %5u invalidating %s cred %p\n",
 		task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
-	if (cred)
-		clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
+
+	clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
 }
 
 int
Do we need that check at all?

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org
www.netapp.com
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help