summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-12-02 22:04:50 -0800
committerDavid S. Miller <davem@davemloft.net>2006-12-02 22:04:50 -0800
commitf9aae95828d3478520f4bd73221bcb450ec1a5c0 (patch)
tree642e3e4b2625e476a1e31fe2e9aebd05a1e20417
parent0c4ca1bd8638d04796553b6e678063c4fadb92cc (diff)
downloadop-kernel-dev-f9aae95828d3478520f4bd73221bcb450ec1a5c0.zip
op-kernel-dev-f9aae95828d3478520f4bd73221bcb450ec1a5c0.tar.gz
[NETFILTER]: nf_conntrack: fix helper structure alignment
Adding the alignment to the size doesn't make any sense, what it should do is align the size of the conntrack structure to the alignment requirements of the helper structure and return an aligned pointer in nfct_help(). Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/netfilter/nf_conntrack.h1
-rw-r--r--net/netfilter/nf_conntrack_helper.c9
2 files changed, 6 insertions, 4 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index d0d0e64..b4beb8c 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -273,6 +273,7 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
if (!(ct->features & NF_CT_F_HELP))
return NULL;
+ offset = ALIGN(offset, __alignof__(struct nf_conn_help));
return (struct nf_conn_help *) ((void *)ct + offset);
}
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 03b3ed8..2628f4b 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -97,13 +97,14 @@ static inline int unhelp(struct nf_conntrack_tuple_hash *i,
int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
{
- int ret;
+ int size, ret;
+
BUG_ON(me->timeout == 0);
+ size = ALIGN(sizeof(struct nf_conn), __alignof__(struct nf_conn_help)) +
+ sizeof(struct nf_conn_help);
ret = nf_conntrack_register_cache(NF_CT_F_HELP, "nf_conntrack:help",
- sizeof(struct nf_conn)
- + sizeof(struct nf_conn_help)
- + __alignof__(struct nf_conn_help));
+ size);
if (ret < 0) {
printk(KERN_ERR "nf_conntrack_helper_register: Unable to create slab cache for conntracks\n");
return ret;
OpenPOWER on IntegriCloud