diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2011-02-22 21:51:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-28 15:36:39 -0500 |
commit | f5a45325284ec10a907b96052ebf2168e7166b5c (patch) | |
tree | da1ab58a1a9ca9b6e790672761782bc6eb9dbf39 | |
parent | 9eb0e6f26e48ef22cc56a2b81b1572ace999f70f (diff) |
f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM
This is similar to what we already do in cdc-phonet.c in the same
situation. pskb_pull() refuses to work with HIGHMEM, even if it is
known that the socket buffer is entirely in "low" memory.
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/usb/gadget/f_phonet.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 3c6e1a058745..5e1495097ec3 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -346,14 +346,19 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req) | |||
346 | 346 | ||
347 | if (unlikely(!skb)) | 347 | if (unlikely(!skb)) |
348 | break; | 348 | break; |
349 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, 0, | ||
350 | req->actual); | ||
351 | page = NULL; | ||
352 | 349 | ||
353 | if (req->actual < req->length) { /* Last fragment */ | 350 | if (skb->len == 0) { /* First fragment */ |
354 | skb->protocol = htons(ETH_P_PHONET); | 351 | skb->protocol = htons(ETH_P_PHONET); |
355 | skb_reset_mac_header(skb); | 352 | skb_reset_mac_header(skb); |
356 | pskb_pull(skb, 1); | 353 | /* Can't use pskb_pull() on page in IRQ */ |
354 | memcpy(skb_put(skb, 1), page_address(page), 1); | ||
355 | } | ||
356 | |||
357 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, | ||
358 | skb->len == 0, req->actual); | ||
359 | page = NULL; | ||
360 | |||
361 | if (req->actual < req->length) { /* Last fragment */ | ||
357 | skb->dev = dev; | 362 | skb->dev = dev; |
358 | dev->stats.rx_packets++; | 363 | dev->stats.rx_packets++; |
359 | dev->stats.rx_bytes += skb->len; | 364 | dev->stats.rx_bytes += skb->len; |