[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090603114753.GA7234@ff.dom.local>
Date: Wed, 3 Jun 2009 11:47:53 +0000
From: Jarek Poplawski <jarkao2@...il.com>
To: David Miller <davem@...emloft.net>
Cc: error27@...il.com, netdev@...r.kernel.org
Subject: Re: potential null dereference in proto_register()
On 02-06-2009 11:54, David Miller wrote:
> From: Dan Carpenter <error27@...il.com>
> Date: Tue, 2 Jun 2009 11:50:52 +0300 (EAT)
>
>> There is a potential null dereference in proto_register()
>> from net/core/sock.c
>>
>> prot->rsk_prot can be null on line 2161 but we dereference it on line
>> 2167.
>>
>> 2161 out_free_request_sock_slab:
>> 2162 if (prot->rsk_prot && prot->rsk_prot->slab) {
>> 2163 kmem_cache_destroy(prot->rsk_prot->slab);
>> 2164 prot->rsk_prot->slab = NULL;
>> 2165 }
>> 2166 out_free_request_sock_slab_name:
>> 2167 kfree(prot->rsk_prot->slab_name);
>>
>> Found by smatch.
>
> This won't ever happen because a protocol that provides a twsk_prot
> has to provide a rsk_prot too.
Then, according to smatch, we should change it:
- if (prot->rsk_prot && prot->rsk_prot->slab) {
+ if (prot->rsk_prot->slab) {
Jarek P.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists