]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
nf_conntrack: padding breaks conntrack hash on ARM
authorPhilip Craig <philipc@snapgear.com>
Tue, 13 May 2008 11:39:13 +0000 (13:39 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 15 May 2008 14:50:03 +0000 (07:50 -0700)
[NETFILTER]: nf_conntrack: padding breaks conntrack hash on ARM

Upstream commit 443a70d50:

commit 0794935e "[NETFILTER]: nf_conntrack: optimize hash_conntrack()"
results in ARM platforms hashing uninitialised padding.  This padding
doesn't exist on other architectures.

Fix this by replacing NF_CT_TUPLE_U_BLANK() with memset() to ensure
everything is initialised.  There were only 4 bytes that
NF_CT_TUPLE_U_BLANK() wasn't clearing anyway (or 12 bytes on ARM).

Signed-off-by: Philip Craig <philipc@snapgear.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/net/netfilter/nf_conntrack_tuple.h
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/netfilter/nf_conntrack_core.c

index e69ab2e875973f205cd9e569c82dbfb6e08ab0d4..d9a4f7ff39ab140a74f34666e5e94005b2e072f1 100644 (file)
@@ -101,16 +101,6 @@ struct nf_conntrack_tuple_mask
        } src;
 };
 
-/* This is optimized opposed to a memset of the whole structure.  Everything we
- * really care about is the  source/destination unions */
-#define NF_CT_TUPLE_U_BLANK(tuple)                                     \
-        do {                                                           \
-                (tuple)->src.u.all = 0;                                \
-                (tuple)->dst.u.all = 0;                                \
-               memset(&(tuple)->src.u3, 0, sizeof((tuple)->src.u3));   \
-               memset(&(tuple)->dst.u3, 0, sizeof((tuple)->dst.u3));   \
-        } while (0)
-
 #ifdef __KERNEL__
 
 #define NF_CT_DUMP_TUPLE(tp)                                                \
index a65b845c5f1596ec5d7732b6d84508f1133eef3f..50ad6efc5fd5026b4adb4386eb133bb5b446c6e8 100644 (file)
@@ -305,7 +305,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)
        const struct nf_conntrack_tuple_hash *h;
        struct nf_conntrack_tuple tuple;
 
-       NF_CT_TUPLE_U_BLANK(&tuple);
+       memset(&tuple, 0, sizeof(tuple));
        tuple.src.u3.ip = inet->rcv_saddr;
        tuple.src.u.tcp.port = inet->sport;
        tuple.dst.u3.ip = inet->daddr;
index b77eb56a87e33a7ec85bd351e5b6d512922ebbc3..4147de6f736a2ed0d2669b5beab10deea3bbab57 100644 (file)
@@ -104,7 +104,7 @@ nf_ct_get_tuple(const struct sk_buff *skb,
                const struct nf_conntrack_l3proto *l3proto,
                const struct nf_conntrack_l4proto *l4proto)
 {
-       NF_CT_TUPLE_U_BLANK(tuple);
+       memset(tuple, 0, sizeof(*tuple));
 
        tuple->src.l3num = l3num;
        if (l3proto->pkt_to_tuple(skb, nhoff, tuple) == 0)
@@ -153,7 +153,7 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
                   const struct nf_conntrack_l3proto *l3proto,
                   const struct nf_conntrack_l4proto *l4proto)
 {
-       NF_CT_TUPLE_U_BLANK(inverse);
+       memset(inverse, 0, sizeof(*inverse));
 
        inverse->src.l3num = orig->src.l3num;
        if (l3proto->invert_tuple(inverse, orig) == 0)