netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: error27@gmail.com, netdev@vger.kernel.org
Subject: Re: potential null dereference in proto_register()
Date: Wed, 3 Jun 2009 11:47:53 +0000	[thread overview]
Message-ID: <20090603114753.GA7234@ff.dom.local> (raw)
In-Reply-To: <20090602.025454.127590436.davem@davemloft.net>

On 02-06-2009 11:54, David Miller wrote:
> From: Dan Carpenter <error27@gmail.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.

      reply	other threads:[~2009-06-03 11:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-02  8:50 potential null dereference in proto_register() Dan Carpenter
2009-06-02  9:54 ` David Miller
2009-06-03 11:47   ` Jarek Poplawski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090603114753.GA7234@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=davem@davemloft.net \
    --cc=error27@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).