Re: [PATCH] Fix for possible null pointer dereference in auth.c

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

 



Hi

I have made a new patch according Sergei specification.

But there remains Tronds question though.

Best regards
Rickard Strandqvist


2014-05-16 14:19 GMT+02:00 Sergei Shtylyov <sergei.shtylyov@xxxxxxxxxxxxxxxxxx>:
> Hello.
>
>
> On 16-05-2014 1:56, Rickard Strandqvist wrote:
>
>> There is otherwise a risk of a possible null pointer dereference.
>
>
>> Was largely found by using a static code analysis program called cppcheck.
>
>
>> Signed-off-by: Rickard Strandqvist
>> <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
>> ---
>>   net/sunrpc/auth.c |   10 +++++++---
>>   1 fil ändrad, 7 tillägg(+), 3 borttagningar(-)
>
>
>> diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
>> index 5285ead..3a55698 100644
>> --- a/net/sunrpc/auth.c
>> +++ b/net/sunrpc/auth.c
>> @@ -801,10 +801,14 @@ rpcauth_invalcred(struct rpc_task *task)
>>   {
>>         struct rpc_cred *cred = task->tk_rqstp->rq_cred;
>>
>> -       dprintk("RPC: %5u invalidating %s cred %p\n",
>> -               task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
>> -       if (cred)
>> +       if (cred) {
>> +               dprintk("RPC: %5u invalidating %s cred %p\n",
>> +                       task->tk_pid, cred->cr_auth->au_ops->au_name,
>> cred);
>> +
>>                 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
>> +       }
>> +       else
>
>
>    } and *else* should be on the same line, and there should be {} in the
> *else* arm since there's {} in the *if* arm already, according to
> Documentation/CodingStyle.
>
>
>> +               dprintk("RPC: %5u invalidating is NULL\n", task->tk_pid);
>
>
>    That's not a proper English, I'm afraid.
>
>>   }
>
>
> WBR, Sergei
>
>
From 210994905f7f7b13f6c621f110699f28fd134980 Mon Sep 17 00:00:00 2001
From: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Date: Sun, 11 May 2014 18:51:42 +0200
Subject: [PATCH] net: sunrpc: auth.c: Fix for possible null pointer dereference

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
---
 net/sunrpc/auth.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 5285ead..a9e1866 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -801,10 +801,14 @@ rpcauth_invalcred(struct rpc_task *task)
 {
 	struct rpc_cred *cred = task->tk_rqstp->rq_cred;
 
-	dprintk("RPC: %5u invalidating %s cred %p\n",
-		task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
-	if (cred)
+	if (cred) {
+		dprintk("RPC: %5u invalidating %s cred %p\n",
+			task->tk_pid, cred->cr_auth->au_ops->au_name, cred);
+
 		clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
+	} else {
+		dprintk("RPC: %5u cred pointer is 0", task->tk_pid);
+	}
 }
 
 int
-- 
1.7.10.4


[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