All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dirk Morris <dmorris@metavize.com>
To: dmorris@metavize.com,  netfilter-devel@lists.netfilter.org
Subject: [PATCH] ipt_do_table accesss pskb after it has been freed
Date: Thu, 06 Nov 2003 18:18:15 -0800	[thread overview]
Message-ID: <3FAB00E7.1030507@metavize.com> (raw)

I had a target in the mangle/PREROUTING that was freeing the skb and 
returning NF_STOLEN.
ipt_do_table would then cause a kernel panic as it accesses the skb 
after its freed.

Is this a bug? If so, here's the patch.

-dirk

-->

diff -urN --ignore-all-space 
linux-2.6.0-test8-orig/net/ipv4/netfilter/ip_tables.c 
linux-2.6.0-test8-netcap2/net/ipv4/netfilter/ip_tables.c
--- linux-2.6.0-test8-orig/net/ipv4/netfilter/ip_tables.c       
2003-10-17 14:42:57.000000000 -0700
+++ linux-2.6.0-test8-netcap2/net/ipv4/netfilter/ip_tables.c    
2003-11-06 18:03:26.000000000 -0800
@@ -375,8 +375,10 @@
                                       = 0x57acc001;
#endif
                               /* Target might have changed stuff. */
+              if (verdict != NF_STOLEN) {
                               ip = (*pskb)->nh.iph;
                               datalen = (*pskb)->len - ip->ihl * 4;
+              }

                               if (verdict == IPT_CONTINUE)
                                       e = (void *)e + e->next_offset;

             reply	other threads:[~2003-11-07  2:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-07  2:18 Dirk Morris [this message]
2003-11-07  8:57 ` [PATCH] ipt_do_table accesss pskb after it has been freed Harald Welte
2003-11-07 16:09   ` dmorris
2003-11-07 18:18     ` Henrik Nordstrom

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=3FAB00E7.1030507@metavize.com \
    --to=dmorris@metavize.com \
    --cc=netfilter-devel@lists.netfilter.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 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.