diff options
Diffstat (limited to 'drivers/net/wireless/wl1251/tx.c')
-rw-r--r-- | drivers/net/wireless/wl1251/tx.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/net/wireless/wl1251/tx.c b/drivers/net/wireless/wl1251/tx.c index 10112de55493..28121c590a2b 100644 --- a/drivers/net/wireless/wl1251/tx.c +++ b/drivers/net/wireless/wl1251/tx.c | |||
@@ -213,16 +213,30 @@ static int wl1251_tx_send_packet(struct wl1251 *wl, struct sk_buff *skb, | |||
213 | wl1251_debug(DEBUG_TX, "skb offset %d", offset); | 213 | wl1251_debug(DEBUG_TX, "skb offset %d", offset); |
214 | 214 | ||
215 | /* check whether the current skb can be used */ | 215 | /* check whether the current skb can be used */ |
216 | if (!skb_cloned(skb) && (skb_tailroom(skb) >= offset)) { | 216 | if (skb_cloned(skb) || (skb_tailroom(skb) < offset)) { |
217 | unsigned char *src = skb->data; | 217 | struct sk_buff *newskb = skb_copy_expand(skb, 0, 3, |
218 | GFP_KERNEL); | ||
219 | |||
220 | if (unlikely(newskb == NULL)) { | ||
221 | wl1251_error("Can't allocate skb!"); | ||
222 | return -EINVAL; | ||
223 | } | ||
224 | |||
225 | tx_hdr = (struct tx_double_buffer_desc *) newskb->data; | ||
226 | |||
227 | dev_kfree_skb_any(skb); | ||
228 | wl->tx_frames[tx_hdr->id] = skb = newskb; | ||
218 | 229 | ||
219 | /* align the buffer on a 4-byte boundary */ | 230 | offset = (4 - (long)skb->data) & 0x03; |
231 | wl1251_debug(DEBUG_TX, "new skb offset %d", offset); | ||
232 | } | ||
233 | |||
234 | /* align the buffer on a 4-byte boundary */ | ||
235 | if (offset) { | ||
236 | unsigned char *src = skb->data; | ||
220 | skb_reserve(skb, offset); | 237 | skb_reserve(skb, offset); |
221 | memmove(skb->data, src, skb->len); | 238 | memmove(skb->data, src, skb->len); |
222 | tx_hdr = (struct tx_double_buffer_desc *) skb->data; | 239 | tx_hdr = (struct tx_double_buffer_desc *) skb->data; |
223 | } else { | ||
224 | wl1251_info("No handler, fixme!"); | ||
225 | return -EINVAL; | ||
226 | } | 240 | } |
227 | } | 241 | } |
228 | 242 | ||