diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/ipt_ULOG.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index 2fe64133bba3..180a9ea57b69 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -147,22 +147,26 @@ static void ulog_timer(unsigned long data) | |||
147 | static struct sk_buff *ulog_alloc_skb(unsigned int size) | 147 | static struct sk_buff *ulog_alloc_skb(unsigned int size) |
148 | { | 148 | { |
149 | struct sk_buff *skb; | 149 | struct sk_buff *skb; |
150 | unsigned int n; | ||
150 | 151 | ||
151 | /* alloc skb which should be big enough for a whole | 152 | /* alloc skb which should be big enough for a whole |
152 | * multipart message. WARNING: has to be <= 131000 | 153 | * multipart message. WARNING: has to be <= 131000 |
153 | * due to slab allocator restrictions */ | 154 | * due to slab allocator restrictions */ |
154 | 155 | ||
155 | skb = alloc_skb(nlbufsiz, GFP_ATOMIC); | 156 | n = max(size, nlbufsiz); |
157 | skb = alloc_skb(n, GFP_ATOMIC); | ||
156 | if (!skb) { | 158 | if (!skb) { |
157 | PRINTR("ipt_ULOG: can't alloc whole buffer %ub!\n", | 159 | PRINTR("ipt_ULOG: can't alloc whole buffer %ub!\n", n); |
158 | nlbufsiz); | ||
159 | 160 | ||
160 | /* try to allocate only as much as we need for | 161 | if (n > size) { |
161 | * current packet */ | 162 | /* try to allocate only as much as we need for |
163 | * current packet */ | ||
162 | 164 | ||
163 | skb = alloc_skb(size, GFP_ATOMIC); | 165 | skb = alloc_skb(size, GFP_ATOMIC); |
164 | if (!skb) | 166 | if (!skb) |
165 | PRINTR("ipt_ULOG: can't even allocate %ub\n", size); | 167 | PRINTR("ipt_ULOG: can't even allocate %ub\n", |
168 | size); | ||
169 | } | ||
166 | } | 170 | } |
167 | 171 | ||
168 | return skb; | 172 | return skb; |