aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-10-17 22:48:26 -0400
committerDavid S. Miller <davem@davemloft.net>2007-10-17 22:48:26 -0400
commitc95477090a2ace6d241c184adc3fbfcab9c61ceb (patch)
tree78c43a301f18f4ad4486a48227a9ca45239208f3 /net
parent48d60056387c37a17a46feda48613587a90535e5 (diff)
[INET]: Consolidate frag queues freeing
Since we now allocate the queues in inet_fragment.c, we can safely free it in the same place. The ->destructor callback thus becomes optional for inet_frags. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/inet_fragment.c4
-rw-r--r--net/ipv4/ip_fragment.c1
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c7
-rw-r--r--net/ipv6/reassembly.c7
4 files changed, 5 insertions, 14 deletions
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 3ed09dd93442..e15e04fc6661 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -136,7 +136,9 @@ void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f,
136 *work -= f->qsize; 136 *work -= f->qsize;
137 atomic_sub(f->qsize, &f->mem); 137 atomic_sub(f->qsize, &f->mem);
138 138
139 f->destructor(q); 139 if (f->destructor)
140 f->destructor(q);
141 kfree(q);
140 142
141} 143}
142EXPORT_SYMBOL(inet_frag_destroy); 144EXPORT_SYMBOL(inet_frag_destroy);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 314593b20506..453ae041edde 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -171,7 +171,6 @@ static __inline__ void ip4_frag_free(struct inet_frag_queue *q)
171 qp = container_of(q, struct ipq, q); 171 qp = container_of(q, struct ipq, q);
172 if (qp->peer) 172 if (qp->peer)
173 inet_putpeer(qp->peer); 173 inet_putpeer(qp->peer);
174 kfree(qp);
175} 174}
176 175
177 176
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 25746d31504d..e170c67c47a5 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -130,11 +130,6 @@ static inline void frag_kfree_skb(struct sk_buff *skb, unsigned int *work)
130 kfree_skb(skb); 130 kfree_skb(skb);
131} 131}
132 132
133static void nf_frag_free(struct inet_frag_queue *q)
134{
135 kfree(container_of(q, struct nf_ct_frag6_queue, q));
136}
137
138/* Destruction primitives. */ 133/* Destruction primitives. */
139 134
140static __inline__ void fq_put(struct nf_ct_frag6_queue *fq) 135static __inline__ void fq_put(struct nf_ct_frag6_queue *fq)
@@ -682,7 +677,7 @@ int nf_ct_frag6_init(void)
682 nf_frags.ctl = &nf_frags_ctl; 677 nf_frags.ctl = &nf_frags_ctl;
683 nf_frags.hashfn = nf_hashfn; 678 nf_frags.hashfn = nf_hashfn;
684 nf_frags.constructor = ip6_frag_init; 679 nf_frags.constructor = ip6_frag_init;
685 nf_frags.destructor = nf_frag_free; 680 nf_frags.destructor = NULL;
686 nf_frags.skb_free = nf_skb_free; 681 nf_frags.skb_free = nf_skb_free;
687 nf_frags.qsize = sizeof(struct nf_ct_frag6_queue); 682 nf_frags.qsize = sizeof(struct nf_ct_frag6_queue);
688 nf_frags.match = ip6_frag_match; 683 nf_frags.match = ip6_frag_match;
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 01766bc75b6a..76c88a93b9b5 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -175,11 +175,6 @@ void ip6_frag_init(struct inet_frag_queue *q, void *a)
175} 175}
176EXPORT_SYMBOL(ip6_frag_init); 176EXPORT_SYMBOL(ip6_frag_init);
177 177
178static void ip6_frag_free(struct inet_frag_queue *fq)
179{
180 kfree(container_of(fq, struct frag_queue, q));
181}
182
183/* Destruction primitives. */ 178/* Destruction primitives. */
184 179
185static __inline__ void fq_put(struct frag_queue *fq) 180static __inline__ void fq_put(struct frag_queue *fq)
@@ -645,7 +640,7 @@ void __init ipv6_frag_init(void)
645 ip6_frags.ctl = &ip6_frags_ctl; 640 ip6_frags.ctl = &ip6_frags_ctl;
646 ip6_frags.hashfn = ip6_hashfn; 641 ip6_frags.hashfn = ip6_hashfn;
647 ip6_frags.constructor = ip6_frag_init; 642 ip6_frags.constructor = ip6_frag_init;
648 ip6_frags.destructor = ip6_frag_free; 643 ip6_frags.destructor = NULL;
649 ip6_frags.skb_free = NULL; 644 ip6_frags.skb_free = NULL;
650 ip6_frags.qsize = sizeof(struct frag_queue); 645 ip6_frags.qsize = sizeof(struct frag_queue);
651 ip6_frags.match = ip6_frag_match; 646 ip6_frags.match = ip6_frag_match;