netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: error27@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: potential null dereference in proto_register()
Date: Tue, 02 Jun 2009 02:54:54 -0700 (PDT)	[thread overview]
Message-ID: <20090602.025454.127590436.davem@davemloft.net> (raw)
In-Reply-To: <alpine.DEB.2.00.0905271607370.11440@bicker>

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.

  reply	other threads:[~2009-06-02  9:54 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 [this message]
2009-06-03 11:47   ` Jarek Poplawski

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=20090602.025454.127590436.davem@davemloft.net \
    --to=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).