Skip to contentSkip to conversation

f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM

PATCH Applied Rémi Denis-Courmont 4 participants 4 messages Feb 23, 2011 – Mar 1, 2011 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM

In reply to a message not in the archive

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.

---
 drivers/usb/gadget/f_phonet.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
drivers/usb/gadget/f_phonet.c +10 -5
index 3c6e1a0..5e14950 100644
@@ -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;
Signature · 1 line
1.7.1
maintainer Applied
#2 lore raw

From: Rémi Denis-Courmont <[email protected]>
Date: Wed, 23 Feb 2011 14:51:33 +0200

Quoted 5 lines

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.

Applied, thanks.

#4 lore raw
In reply to a message not in the archive
Quoted 10 lines · you

From: Rémi Denis-Courmont <[email protected]>
Date: Wed, 23 Feb 2011 14:51:33 +0200

Quoted 5 lines

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.

Applied, thanks.

Hmm, this is already somewhere in linux-usb, from what I understood (I suppose git-merge does not care much).

Signature · 6 lines
Rémi Denis-Courmont
http://www.remlab.net/
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw
In reply to a message not in the archive

From: "Rémi Denis-Courmont" <[email protected]>
Date: Tue, 1 Mar 2011 09:34:30 +0200

Quoted 8 lines · you
Quoted 7 lines

From: Rémi Denis-Courmont <[email protected]>
Date: Wed, 23 Feb 2011 14:51:33 +0200

Quoted 4 lines

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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks.

Hmm, this is already somewhere in linux-usb, from what I understood (I suppose git-merge does not care much).

Yeah, it'll work itself out without any problems.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html