aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/reassembly.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/reassembly.c')
-rw-r--r--net/ipv6/reassembly.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 73ea204eaa6f..21913c78f053 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -171,12 +171,10 @@ static void ip6_frag_free(struct inet_frag_queue *fq)
171 171
172static inline struct frag_queue *frag_alloc_queue(void) 172static inline struct frag_queue *frag_alloc_queue(void)
173{ 173{
174 struct frag_queue *fq = kzalloc(sizeof(struct frag_queue), GFP_ATOMIC); 174 struct inet_frag_queue *q;
175 175
176 if(!fq) 176 q = inet_frag_alloc(&ip6_frags);
177 return NULL; 177 return q ? container_of(q, struct frag_queue, q) : NULL;
178 atomic_add(sizeof(struct frag_queue), &ip6_frags.mem);
179 return fq;
180} 178}
181 179
182/* Destruction primitives. */ 180/* Destruction primitives. */
@@ -205,9 +203,11 @@ static void ip6_evictor(struct inet6_dev *idev)
205 203
206static void ip6_frag_expire(unsigned long data) 204static void ip6_frag_expire(unsigned long data)
207{ 205{
208 struct frag_queue *fq = (struct frag_queue *) data; 206 struct frag_queue *fq;
209 struct net_device *dev = NULL; 207 struct net_device *dev = NULL;
210 208
209 fq = container_of((struct inet_frag_queue *)data, struct frag_queue, q);
210
211 spin_lock(&fq->q.lock); 211 spin_lock(&fq->q.lock);
212 212
213 if (fq->q.last_in & COMPLETE) 213 if (fq->q.last_in & COMPLETE)
@@ -268,12 +268,6 @@ ip6_frag_create(__be32 id, struct in6_addr *src, struct in6_addr *dst,
268 ipv6_addr_copy(&fq->saddr, src); 268 ipv6_addr_copy(&fq->saddr, src);
269 ipv6_addr_copy(&fq->daddr, dst); 269 ipv6_addr_copy(&fq->daddr, dst);
270 270
271 init_timer(&fq->q.timer);
272 fq->q.timer.function = ip6_frag_expire;
273 fq->q.timer.data = (long) fq;
274 spin_lock_init(&fq->q.lock);
275 atomic_set(&fq->q.refcnt, 1);
276
277 return ip6_frag_intern(fq, hash); 271 return ip6_frag_intern(fq, hash);
278 272
279oom: 273oom:
@@ -685,5 +679,6 @@ void __init ipv6_frag_init(void)
685 ip6_frags.skb_free = NULL; 679 ip6_frags.skb_free = NULL;
686 ip6_frags.qsize = sizeof(struct frag_queue); 680 ip6_frags.qsize = sizeof(struct frag_queue);
687 ip6_frags.equal = ip6_frag_equal; 681 ip6_frags.equal = ip6_frag_equal;
682 ip6_frags.frag_expire = ip6_frag_expire;
688 inet_frags_init(&ip6_frags); 683 inet_frags_init(&ip6_frags);
689} 684}