Skip to contentSkip to conversation

netfilter: fix panic on ip_conntrack_h323 with CONFIG_IP_NF_CT_ACCT

PATCH In review Faidon Liambotis 2 participants 2 messages Nov 16, 2006

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

PATCH 1/1 netfilter: fix panic on ip_conntrack_h323 with CONFIG_IP_NF_CT_ACCT

H.323 connection tracking code calls ip_ct_refresh_acct() when processing RCFs and URQs but passes NULL as the skb.
When CONFIG_IP_NF_CT_ACCT is enabled, the connection tracking core tries to derefence the skb, which results in an obvious panic.
A similar fix was applied on the SIP connection tracking code some time ago.

net/ipv4/netfilter/ip_conntrack_helper_h323.c +2 -2
@@ -1417,7 +1417,7 @@ static int process_rcf(struct sk_buff **
 		DEBUGP
 		    ("ip_ct_ras: set RAS connection timeout to %u seconds\n",
 		     info->timeout);
-		ip_ct_refresh_acct(ct, ctinfo, NULL, info->timeout * HZ);
+		ip_ct_refresh_acct(ct, ctinfo, *pskb, info->timeout * HZ);
 
 		/* Set expect timeout */
 		read_lock_bh(&ip_conntrack_lock);
@@ -1465,7 +1465,7 @@ static int process_urq(struct sk_buff **
 	info->sig_port[!dir] = 0;
 
 	/* Give it 30 seconds for UCF or URJ */
-	ip_ct_refresh_acct(ct, ctinfo, NULL, 30 * HZ);
+	ip_ct_refresh_acct(ct, ctinfo, *pskb, 30 * HZ);
 
 	return 0;
 }
#1 lore raw
Quoted 6 lines · Faidon Liambotis

H.323 connection tracking code calls ip_ct_refresh_acct() when processing RCFs and URQs but passes NULL as the skb.
When CONFIG_IP_NF_CT_ACCT is enabled, the connection tracking core tries to derefence the skb, which results in an obvious panic.
A similar fix was applied on the SIP connection tracking code some time ago.

Good catch, but the fix is wrong and will lead to double accounting of the skb. The correct fix is to use ip_ct_refresh() instead, which only updates the timeout. Can you send a new patch please?

Quoted 23 lines
net/ipv4/netfilter/ip_conntrack_helper_h323.c +2 -2
@@ -1417,7 +1417,7 @@ static int process_rcf(struct sk_buff **
 		DEBUGP
 		    ("ip_ct_ras: set RAS connection timeout to %u seconds\n",
 		     info->timeout);
-		ip_ct_refresh_acct(ct, ctinfo, NULL, info->timeout * HZ);
+		ip_ct_refresh_acct(ct, ctinfo, *pskb, info->timeout * HZ);
 
 		/* Set expect timeout */
 		read_lock_bh(&ip_conntrack_lock);
@@ -1465,7 +1465,7 @@ static int process_urq(struct sk_buff **
 	info->sig_port[!dir] = 0;
 
 	/* Give it 30 seconds for UCF or URJ */
-	ip_ct_refresh_acct(ct, ctinfo, NULL, 30 * HZ);
+	ip_ct_refresh_acct(ct, ctinfo, *pskb, 30 * HZ);
 
 	return 0;
 }