Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=30c08c41be75145b8850ea14b2d5ee4ee4b705d8
Commit:     30c08c41be75145b8850ea14b2d5ee4ee4b705d8
Parent:     89c002d66aafab93814b38d8dae43fa50aec390a
Author:     Patrick McHardy <[EMAIL PROTECTED]>
AuthorDate: Mon Dec 17 21:47:14 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:58:30 2008 -0800

    [NETFILTER]: ip_tables: account for struct ipt_entry/struct 
compat_ipt_entry size diff
    
    Account for size differences when dumping entries or calculating the
    entry positions. This doesn't actually make any difference for IPv4
    since the structures have the same size, but its logically correct
    and needed for IPv6.
    
    Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/netfilter/ip_tables.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 4586af3..cc896fe 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1098,7 +1098,7 @@ static int compat_calc_entry(struct ipt_entry *e,
        unsigned int entry_offset;
        int off, i, ret;
 
-       off = 0;
+       off = sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
        entry_offset = (void *)e - base;
        IPT_MATCH_ITERATE(e, compat_calc_match, &off);
        t = ipt_get_target(e);
@@ -1501,6 +1501,8 @@ compat_copy_entry_to_user(struct ipt_entry *e, void 
__user **dstptr,
                goto out;
 
        *dstptr += sizeof(struct compat_ipt_entry);
+       *size -= sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
+
        ret = IPT_MATCH_ITERATE(e, xt_compat_match_to_user, dstptr, size);
        target_offset = e->target_offset - (origsize - *size);
        if (ret)
@@ -1605,7 +1607,7 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e,
        if (ret)
                return ret;
 
-       off = 0;
+       off = sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
        entry_offset = (void *)e - (void *)base;
        j = 0;
        ret = IPT_MATCH_ITERATE(e, compat_find_calc_match, name, &e->ip,
@@ -1671,6 +1673,8 @@ compat_copy_entry_from_user(struct ipt_entry *e, void 
**dstptr,
        memcpy(de, e, sizeof(struct ipt_entry));
 
        *dstptr += sizeof(struct compat_ipt_entry);
+       *size += sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
+
        ret = IPT_MATCH_ITERATE(e, xt_compat_match_from_user, dstptr, size);
        if (ret)
                return ret;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to