All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] fix ipt_ACCOUNT for 32bit netmasks
@ 2005-05-13 11:08 Thomas Jarosch
  2005-05-17 19:48 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Jarosch @ 2005-05-13 11:08 UTC (permalink / raw)
  To: netfilter

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

Hi,

attached is a patch to fix ipt_ACCOUNT for /32 netmasks.
While looking through the code I also found and fixed a locking bug.

Please apply the patch or let me know if there's trouble applying.

Cheers,
Thomas

[-- Attachment #2: ipt_ACCOUNT-32bitnetmask-fix.patch --]
[-- Type: text/x-diff, Size: 1075 bytes --]

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>

diff -U3 -r1.32 -r1.34
--- ACCOUNT/linux/net/ipv4/netfilter/ipt_ACCOUNT.c	14 Apr 2005 20:55:52 -0000	1.32
+++ ACCOUNT/linux/net/ipv4/netfilter/ipt_ACCOUNT.c	13 May 2005 10:04:31 -0000	1.34
@@ -137,7 +137,8 @@
     for (i = 0; i < ACCOUNT_MAX_TABLES; i++) {
         /* Found free slot */
         if (ipt_acc_tables[i].name[0] == 0) {
-            u_int32_t j, calc_mask, netsize=0;
+            u_int32_t calc_mask, netsize=0;
+            int j;  /* needs to be signed, otherwise we risk endless loop */
             
             DEBUGP("ACCOUNT: Found free slot: %d\n", i);
             strncpy (ipt_acc_tables[i].name, name, ACCOUNT_TABLE_NAME_LEN-1);
@@ -890,6 +891,7 @@
             down(&ipt_acc_userspace_mutex);
             if ((handle.handle_nr = ipt_acc_handle_find_slot()) == -1) {
                 ipt_acc_data_free(dest.data, dest.depth);
+                up(&ipt_acc_userspace_mutex);
                 return -EINVAL;
             }
             memcpy(&ipt_acc_handles[handle.handle_nr], &dest,

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

end of thread, other threads:[~2005-05-17 19:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-13 11:08 [patch] fix ipt_ACCOUNT for 32bit netmasks Thomas Jarosch
2005-05-17 19:48 ` Patrick McHardy

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.