Skip to contentSkip to conversation

possible use of freed skbuff in netfilter.c

RFC PATCH In review Bart De Schuymer 3 participants 5 messages Apr 25, 2003 – Apr 30, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 possible use of freed skbuff in netfilter.c

Hello Dave,

When dev_put'ing bridge devices in netfilter.c::reinject the skb can already be freed. The patch below fixes this by delaying the freeing of the skb a bit. AFAIK, calling kfree_skb outside the read_lock causes no problems. Could someone of the netfilter core team approve or disapprove this change? This is bug 86 of the netfilter bugtracking system.

cheers,
Bart

net/core/netfilter.c renamed from net/core/netfilter.c.old +4 -4
@@ -559,10 +559,6 @@
 		nf_queue(skb, elem, info->pf, info->hook, 
 			 info->indev, info->outdev, info->okfn);
 		break;
-
-	case NF_DROP:
-		kfree_skb(skb);
-		break;
 	}
 	br_read_unlock_bh(BR_NETPROTO_LOCK);
 
@@ -578,6 +574,10 @@
 	}
 #endif
 
+
+	if (verdict == NF_DROP)
+		kfree_skb(skb);
+
 	kfree(info);
 	return;
 }
#1 lore raw
Quoted 7 lines · Bart De Schuymer

Hello Dave,

When dev_put'ing bridge devices in netfilter.c::reinject the skb can already be freed. The patch below fixes this by delaying the freeing of the skb a bit. AFAIK, calling kfree_skb outside the read_lock causes no problems. Could someone of the netfilter core team approve or disapprove this change? This is bug 86 of the netfilter bugtracking system.

I'm fine with this fix, please apply (if it isn't already).

Quoted 2 lines

cheers,
Bart

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#2 lore raw

From: Harald Welte <[email protected]>
Date: Tue, 29 Apr 2003 16:51:29 +0200

I'm fine with this fix, please apply (if it isn't already).

Applied. Should we be putting this fix into 2.4.x as well?

#3 lore raw
Quoted 3 lines · David S. Miller

I'm fine with this fix, please apply (if it isn't already).

Applied. Should we be putting this fix into 2.4.x as well?

No, this is only related to 2.5.

Signature · 2 lines
cheers,
Bart
#4 lore raw
In reply to David S. Miller
Quoted 6 lines · David S. Miller

From: Harald Welte <[email protected]>
Date: Tue, 29 Apr 2003 16:51:29 +0200

I'm fine with this fix, please apply (if it isn't already).

Applied. Should we be putting this fix into 2.4.x as well?

Since 2.4.x doesn't have the physindev/physoutdev, the bug is not present in 2.4.x - and thus no fix needed.

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie