* [PATCH] SUNRPC: Fix possible NULL pointer dereference
@ 2013-02-24 22:23 Syam Sidhardhan
2013-02-24 22:35 ` Myklebust, Trond
0 siblings, 1 reply; 3+ messages in thread
From: Syam Sidhardhan @ 2013-02-24 22:23 UTC (permalink / raw)
To: linux-nfs, netdev; +Cc: davem, Trond.Myklebust, syamsidhardh
Check for cred == NULL has to be done before accessing cred.
Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] SUNRPC: Fix possible NULL pointer dereference
2013-02-24 22:23 [PATCH] SUNRPC: Fix possible NULL pointer dereference Syam Sidhardhan
@ 2013-02-24 22:35 ` Myklebust, Trond
2013-02-25 15:21 ` Syam Sidhardhan
0 siblings, 1 reply; 3+ messages in thread
From: Myklebust, Trond @ 2013-02-24 22:35 UTC (permalink / raw)
To: Syam Sidhardhan
Cc: linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
davem@davemloft.net
On Mon, 2013-02-25 at 03:53 +0530, Syam Sidhardhan wrote:
> Check for cred == NULL has to be done before accessing cred.
>
> Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
> ---
> 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@netapp.com
www.netapp.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] SUNRPC: Fix possible NULL pointer dereference
2013-02-24 22:35 ` Myklebust, Trond
@ 2013-02-25 15:21 ` Syam Sidhardhan
0 siblings, 0 replies; 3+ messages in thread
From: Syam Sidhardhan @ 2013-02-25 15:21 UTC (permalink / raw)
To: Myklebust, Trond
Cc: linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
davem@davemloft.net
Hi Trond,
On Mon, Feb 25, 2013 at 4:05 AM, Myklebust, Trond
<Trond.Myklebust@netapp.com> wrote:
> On Mon, 2013-02-25 at 03:53 +0530, Syam Sidhardhan wrote:
>> Check for cred == NULL has to be done before accessing cred.
>>
>> Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
>> ---
>> 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?
I'm not sure whether we need that check or not. However
similar functions such as rpcauth_refreshcred(), rpcauth_uptodatecred() etc
are doing the same check inside. Cppcheck is throwing an error too.
Regards,
Syam
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-25 15:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-24 22:23 [PATCH] SUNRPC: Fix possible NULL pointer dereference Syam Sidhardhan
2013-02-24 22:35 ` Myklebust, Trond
2013-02-25 15:21 ` Syam Sidhardhan
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).