diff options
Diffstat (limited to 'net/ipv4/inet_fragment.c')
-rw-r--r-- | net/ipv4/inet_fragment.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index ec10e05c6666..15fb2c4a36a7 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/random.h> | 19 | #include <linux/random.h> |
20 | #include <linux/skbuff.h> | ||
21 | #include <linux/rtnetlink.h> | ||
20 | 22 | ||
21 | #include <net/inet_frag.h> | 23 | #include <net/inet_frag.h> |
22 | 24 | ||
@@ -100,3 +102,41 @@ void inet_frag_kill(struct inet_frag_queue *fq, struct inet_frags *f) | |||
100 | } | 102 | } |
101 | 103 | ||
102 | EXPORT_SYMBOL(inet_frag_kill); | 104 | EXPORT_SYMBOL(inet_frag_kill); |
105 | |||
106 | static inline void frag_kfree_skb(struct inet_frags *f, struct sk_buff *skb, | ||
107 | int *work) | ||
108 | { | ||
109 | if (work) | ||
110 | *work -= skb->truesize; | ||
111 | |||
112 | atomic_sub(skb->truesize, &f->mem); | ||
113 | if (f->skb_free) | ||
114 | f->skb_free(skb); | ||
115 | kfree_skb(skb); | ||
116 | } | ||
117 | |||
118 | void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f, | ||
119 | int *work) | ||
120 | { | ||
121 | struct sk_buff *fp; | ||
122 | |||
123 | BUG_TRAP(q->last_in & COMPLETE); | ||
124 | BUG_TRAP(del_timer(&q->timer) == 0); | ||
125 | |||
126 | /* Release all fragment data. */ | ||
127 | fp = q->fragments; | ||
128 | while (fp) { | ||
129 | struct sk_buff *xp = fp->next; | ||
130 | |||
131 | frag_kfree_skb(f, fp, work); | ||
132 | fp = xp; | ||
133 | } | ||
134 | |||
135 | if (work) | ||
136 | *work -= f->qsize; | ||
137 | atomic_sub(f->qsize, &f->mem); | ||
138 | |||
139 | f->destructor(q); | ||
140 | |||
141 | } | ||
142 | EXPORT_SYMBOL(inet_frag_destroy); | ||