All of lore.kernel.org
 help / color / mirror / Atom feed
* FIX: connlimit NULL pointer kernel panic (was: connlimit patch crashes 2.6.11 kernel)
@ 2005-05-18 21:15 Damon Gray
  2005-05-19  3:10 ` Pablo Neira
  0 siblings, 1 reply; 7+ messages in thread
From: Damon Gray @ 2005-05-18 21:15 UTC (permalink / raw)
  To: netfilter-devel; +Cc: mateusz, kaber


I have already submitted this to "the powers that be" but haven't heard 
back yet. Here is how to fix it yourself.

The problem is in ipt_connlimit.c(line 67):

  found = ip_conntrack_find_get(&conn->tuple,ct);
  if (0 == memcmp(&conn->tuple,&tuple,sizeof(tuple)) &&
    found != NULL && (found_ct = tuplehash_to_ctrack(found)) != NULL &&
    found_ct->proto.tcp.state != TCP_CONNTRACK_TIME_WAIT) {
      /* Just to be sure we have it only once in the list.
         We should'nt see tuples twice unless someone hooks this
         into a table without "-p tcp --syn" */
     addit = 0;
  }

The problem is that it is the usual case that "found" will not equal NULL, 
but the memcmp will also not equal 0. This makes it so 
tuplehash_to_ctrack(found) is never run so "found_ct" is always NULL. 
Later in the function "found_ct" is dereferenced when it is NULL, which 
causes the kernel panic. These operations need to be reordered so it is 
guarantee that if "found" != NULL then tuplehash_to_ctrack will always be 
run.

Basically it needs to be changed to:

  if (found != NULL && (found_ct = tuplehash_to_ctrack(found)) != NULL &&
    0 == memcmp(&conn->tuple,&tuple,sizeof(tuple)) &&
    found_ct->proto.tcp.state != TCP_CONNTRACK_TIME_WAIT) {


Change the file to the above and recompile the kernel. I've tested on 
2.6.11.7.

-Damon-

+-------------------------------------------------------+
| Damon Gray                | Core Network Development  |
| (404)302-9756             | Internap Network Services |
| dgray@internap.com        | www.internap.com          |
+-------------------------------------------------------+

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-06-19 12:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20050519075405.7DF8640023@socios.momona.org>
2005-05-19 11:30 ` FIX: connlimit NULL pointer kernel panic (was: connlimit patch crashes 2.6.11 kernel) Pablo Neira
2005-06-11 15:03   ` FIX: connlimit NULL pointer kernel panic Patrick McHardy
2005-06-19 12:12     ` Pablo Neira
2005-06-19 12:18       ` Patrick McHardy
2005-05-18 21:15 FIX: connlimit NULL pointer kernel panic (was: connlimit patch crashes 2.6.11 kernel) Damon Gray
2005-05-19  3:10 ` Pablo Neira
2005-05-19  7:58   ` Forte Systems - Iosif Peterfi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.