* [PATCH] f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM
@ 2011-02-21 14:16 Rémi Denis-Courmont
2011-02-21 14:50 ` Felipe Balbi
0 siblings, 1 reply; 6+ messages in thread
From: Rémi Denis-Courmont @ 2011-02-21 14:16 UTC (permalink / raw)
To: linux-usb, netdev
This is similar to what we arleady do in cdc-phonet.c in the same
situation.
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
---
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 3c6e1a0..5e14950 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)
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;
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM
2011-02-21 14:16 Rémi Denis-Courmont
@ 2011-02-21 14:50 ` Felipe Balbi
0 siblings, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2011-02-21 14:50 UTC (permalink / raw)
To: Rémi Denis-Courmont; +Cc: linux-usb, netdev
On Mon, Feb 21, 2011 at 04:16:53PM +0200, Rémi Denis-Courmont wrote:
> This is similar to what we arleady do in cdc-phonet.c in the same
^^typo
--
balbi
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM
[not found] <linux-usb@vger.kernel.org>
@ 2011-02-23 12:51 ` Rémi Denis-Courmont
2011-02-28 20:38 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Rémi Denis-Courmont @ 2011-02-23 12:51 UTC (permalink / raw)
To: netdev
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>
---
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 3c6e1a0..5e14950 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)
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;
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM
2011-02-23 12:51 ` [PATCH] f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM Rémi Denis-Courmont
@ 2011-02-28 20:38 ` David Miller
[not found] ` <20110228.123844.70195701.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2011-02-28 20:38 UTC (permalink / raw)
To: remi.denis-courmont; +Cc: netdev
From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Date: Wed, 23 Feb 2011 14:51:33 +0200
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM
[not found] ` <20110228.123844.70195701.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
@ 2011-03-01 7:34 ` Rémi Denis-Courmont
[not found] ` <201103010934.30730.remi.denis-courmont-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Rémi Denis-Courmont @ 2011-03-01 7:34 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
On Monday 28 February 2011 22:38:44 ext David Miller, you wrote:
> From: Rémi Denis-Courmont <remi.denis-courmont-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> Date: Wed, 23 Feb 2011 14:51:33 +0200
>
> > 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-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
>
> Applied, thanks.
Hmm, this is already somewhere in linux-usb, from what I understood (I suppose
git-merge does not care much).
--
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM
[not found] ` <201103010934.30730.remi.denis-courmont-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2011-03-01 7:37 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-03-01 7:37 UTC (permalink / raw)
To: remi.denis-courmont-xNZwKgViW5gAvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
From: "Rémi Denis-Courmont" <remi.denis-courmont-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Date: Tue, 1 Mar 2011 09:34:30 +0200
> On Monday 28 February 2011 22:38:44 ext David Miller, you wrote:
>> From: Rémi Denis-Courmont <remi.denis-courmont-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
>> Date: Wed, 23 Feb 2011 14:51:33 +0200
>>
>> > 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-xNZwKgViW5g@public.gmane.orgm>
>>
>> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-01 7:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <linux-usb@vger.kernel.org>
2011-02-23 12:51 ` [PATCH] f_phonet: avoid pskb_pull(), fix OOPS with CONFIG_HIGHMEM Rémi Denis-Courmont
2011-02-28 20:38 ` David Miller
[not found] ` <20110228.123844.70195701.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2011-03-01 7:34 ` Rémi Denis-Courmont
[not found] ` <201103010934.30730.remi.denis-courmont-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2011-03-01 7:37 ` David Miller
2011-02-21 14:16 Rémi Denis-Courmont
2011-02-21 14:50 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).