]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
ebtables: don't compute gap until we know we have an ebt_entry
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 4 Feb 2008 14:29:03 +0000 (14:29 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 4 Feb 2008 14:29:03 +0000 (14:29 +0000)
Original upstream Linux patch by Chuck Ebbert.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
net/bridge/netfilter/ebtables.c

index 1969658a4610083287c304cd6030c7a562d0542d..9301ec4c9fb19d553aacdf7ba445f0e997fbed41 100644 (file)
@@ -597,7 +597,7 @@ ebt_check_entry(struct ebt_entry *e, struct ebt_table_info *newinfo,
        struct ebt_entry_target *t;
        struct ebt_target *target;
        unsigned int i, j, hook = 0, hookmask = 0;
-       size_t gap = e->next_offset - e->target_offset;
+       size_t gap;
        int ret;
 
        /* don't mess with the struct ebt_entries */
@@ -647,6 +647,7 @@ ebt_check_entry(struct ebt_entry *e, struct ebt_table_info *newinfo,
        if (ret != 0)
                goto cleanup_watchers;
        t = (struct ebt_entry_target *)(((char *)e) + e->target_offset);
+       gap = e->next_offset - e->target_offset;
        target = find_target_lock(t->u.name, &ret, &ebt_mutex);
        if (!target)
                goto cleanup_watchers;