[PATCH] SUNRPC: Fix possible NULL pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check for cred == NULL has to be done before accessing cred.

Signed-off-by: Syam Sidhardhan <s.syam@xxxxxxxxxxx>
---
 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
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux