ip_queue memory leaks
PATCH 1/1 ip_queue memory leaks
Hi Dave!
Please apply the following patch (courtesy of Muli Ben-Yehuda). It fixes memory leaks in the ip_queue code for ipv4 and ipv6.
Patch applies cleanly (-p0) to 2.4.21-rc1 and 2.5.68.
Thanks,
Index: net/ipv4/netfilter/ip_queue.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/netfilter/ip_queue.c,v retrieving revision 1.13
ipv4/netfilter/ip_queue.c +5 -1
@@ -300,8 +300,9 @@write_lock_bh (&queue_lock);if (!peer_pid) - goto err_out_unlock; + goto err_out_free_nskb; +/* netlink_unicast will either free the nskb or attach it to a socket */ status =netlink_unicast (ipqnl, nskb, peer_pid,MSG_DONTWAIT );if (status <0 ) goto err_out_unlock;
@@ -312,6 +313,9 @@write_unlock_bh (&queue_lock);return status; + +err_out_free_nskb: +kfree_skb (nskb); err_out_unlock:write_unlock_bh (&queue_lock);
Index: net/ipv6/netfilter/ip6_queue.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/netfilter/ip6_queue.c,v retrieving revision 1.10
ipv6/netfilter/ip6_queue.c +5 -1
@@ -304,8 +304,9 @@write_lock_bh (&queue_lock);if (!peer_pid) - goto err_out_unlock; + goto err_out_free_nskb; +/* netlink_unicast will either free the nskb or attach it to a socket */ status =netlink_unicast (ipqnl, nskb, peer_pid,MSG_DONTWAIT );if (status <0 ) goto err_out_unlock;
@@ -316,6 +317,9 @@write_unlock_bh (&queue_lock);return status; + +err_out_free_nskb: +kfree_skb (nskb); err_out_unlock:write_unlock_bh (&queue_lock);
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
David S. Miller
Applied From: Harald Welte <[email protected]>
Date: Sun, 27 Apr 2003 11:49:49 +0200
Please apply the following patch (courtesy of Muli Ben-Yehuda). It fixes memory leaks in the ip_queue code for ipv4 and ipv6.
Patch applies cleanly (-p0) to 2.4.21-rc1 and 2.5.68.
Applied to both trees, thanks.
PATCH 1/1 fuzzy.patch and fuzzy6.patch.ipv6
Hi,
This is small patch to fix toruble on PPC with netfilter in module. [Without this compiler generate "unresolved symbols"]
Thanx.
Sas.
fuzzy.patch renamed from fuzzy.patch.org +3 -3
@@ -59,7 +59,7 @@ + Expressed in percentage +*/ + -+#define PAR_LOW 0.01 ++#define PAR_LOW 1/100 +#define PAR_HIGH 1 + +static spinlock_t fuzzy_lock = SPIN_LOCK_UNLOCKED ;
@@ -138,7 +138,7 @@ + howlow = mf_low(info->mean_rate,info->minimum_rate,info->maximum_rate); + + info->acceptance_rate = (u_int8_t) \ -+ ( PAR_LOW*howhigh + PAR_HIGH*howlow ) ; ++ ( howhigh*PAR_LOW + PAR_HIGH*howlow ) ; + + /* In fact , the above defuzzification would require a denominator + proportional to (howhigh+howlow) but , in this particular case ,
@@ -158,7 +158,7 @@ + get_random_bytes((void *)(&random_number), 1); + + /* If within the acceptance , it can pass => don't match */ -+ if ( random_number <= 2.55 * info->acceptance_rate ) ++ if ( random_number <= (255 * info->acceptance_rate) / 100 ) + return 0 ; + else + return 1; /* It can't pass ( It matches ) */
fuzzy6.patch.ipv6 renamed from fuzzy6.patch.ipv6.org +3 -3
@@ -60,7 +60,7 @@ + Expressed in percentage +*/ + -+#define PAR_LOW 0.01 ++#define PAR_LOW 1/100 +#define PAR_HIGH 1 + +static spinlock_t fuzzy_lock = SPIN_LOCK_UNLOCKED;
@@ -138,7 +138,7 @@ + howlow = mf_low(info->mean_rate,info->minimum_rate,info->maximum_rate); + + info->acceptance_rate = (u_int8_t) \ -+ (PAR_LOW * howhigh + PAR_HIGH * howlow); ++ (howhigh * PAR_LOW + PAR_HIGH * howlow); + + /* In fact, the above defuzzification would require a denominator + * proportional to (howhigh+howlow) but, in this particular case,
@@ -158,7 +158,7 @@ + get_random_bytes((void *)(&random_number), 1); + + /* If within the acceptance , it can pass => don't match */ -+ if (random_number <= 2.55 * info->acceptance_rate) ++ if (random_number <= (255 * info->acceptance_rate) / 100) + return 0; + else + return 1; /* It can't pass (It matches) */
Signature · 2 lines
{Wojciech 'Sas' Cieciwa} {Member of PLD Team }
{e-mail: [email protected], http://www2.zarz.agh.edu.pl/~cieciwa}Re: [PATCH] fuzzy.patch and fuzzy6.patch.ipv6
Quoted 4 lines · Wojciech Sas Cieciwa
Hi,
This is small patch to fix toruble on PPC with netfilter in module. [Without this compiler generate "unresolved symbols"]
indeed, there is no need for using floating point arithmetics at all.
Hime, would the proposed changes be fine with you (as the original author) ?
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