Skip to content

Commit

Permalink
USB: f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM
Browse files Browse the repository at this point in the history
This is similar to what we already do in cdc-phonet.c in the same
situation.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Rémi Denis-Courmont authored and Greg Kroah-Hartman committed Feb 25, 2011
1 parent 18f5346 commit 10408bb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions drivers/usb/gadget/f_phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,19 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req)

if (unlikely(!skb))
break;
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, 0,
req->actual);
page = NULL;

if (req->actual < req->length) { /* Last fragment */
if (skb->len == 0) { /* First fragment */
skb->protocol = htons(ETH_P_PHONET);
skb_reset_mac_header(skb);
pskb_pull(skb, 1);
/* Can't use pskb_pull() on page in IRQ */
memcpy(skb_put(skb, 1), page_address(page), 1);
}

skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
skb->len == 0, req->actual);
page = NULL;

if (req->actual < req->length) { /* Last fragment */
skb->dev = dev;
dev->stats.rx_packets++;
dev->stats.rx_bytes += skb->len;
Expand Down

0 comments on commit 10408bb

Please sign in to comment.