All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: eem: fix wrong eem header operation
@ 2021-06-03 15:09 Linyu Yuan
  2021-06-04 10:50 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Linyu Yuan @ 2021-06-03 15:09 UTC (permalink / raw)
  To: linux-usb; +Cc: Linyu Yuan

From: Linyu Yuan <linyyuan@codeaurora.com>

when skb_clone() or skb_copy_expand() fail,
it should pull skb with lengh indicated by header,
or not it will read network data and check it as header.

Signed-off-by: Linyu Yuan <linyyuan@codeaurora.com>
---
 drivers/usb/gadget/function/f_eem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c
index cfcc4e81fb77..28dd5f1fd106 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -495,7 +495,7 @@ static int eem_unwrap(struct gether *port,
 			skb2 = skb_clone(skb, GFP_ATOMIC);
 			if (unlikely(!skb2)) {
 				DBG(cdev, "unable to unframe EEM packet\n");
-				continue;
+				goto next;
 			}
 			skb_trim(skb2, len - ETH_FCS_LEN);
 
@@ -505,7 +505,7 @@ static int eem_unwrap(struct gether *port,
 						GFP_ATOMIC);
 			if (unlikely(!skb3)) {
 				dev_kfree_skb_any(skb2);
-				continue;
+				goto next;
 			}
 			dev_kfree_skb_any(skb2);
 			skb_queue_tail(list, skb3);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: gadget: eem: fix wrong eem header operation
  2021-06-03 15:09 [PATCH] usb: gadget: eem: fix wrong eem header operation Linyu Yuan
@ 2021-06-04 10:50 ` Greg KH
  2021-06-07  2:27   ` linyyuan
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2021-06-04 10:50 UTC (permalink / raw)
  To: Linyu Yuan; +Cc: linux-usb, Linyu Yuan

On Thu, Jun 03, 2021 at 11:09:47PM +0800, Linyu Yuan wrote:
> From: Linyu Yuan <linyyuan@codeaurora.com>
> 
> when skb_clone() or skb_copy_expand() fail,

How can these calls fail?  If they do, what is the overall system
health?

> it should pull skb with lengh indicated by header,
> or not it will read network data and check it as header.
> 
> Signed-off-by: Linyu Yuan <linyyuan@codeaurora.com>
> ---
>  drivers/usb/gadget/function/f_eem.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

What commit does this fix?  Should it go to stable kernels?  If so, how
far back?

And any reason you didn't use scripts/get_maintainer.pl for who to send
your patch to?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: gadget: eem: fix wrong eem header operation
  2021-06-04 10:50 ` Greg KH
@ 2021-06-07  2:27   ` linyyuan
  0 siblings, 0 replies; 3+ messages in thread
From: linyyuan @ 2021-06-07  2:27 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, Linyu Yuan

On 2021-06-04 18:50, Greg KH wrote:
> On Thu, Jun 03, 2021 at 11:09:47PM +0800, Linyu Yuan wrote:
>> From: Linyu Yuan <linyyuan@codeaurora.com>
>> 
>> when skb_clone() or skb_copy_expand() fail,
> 
> How can these calls fail?  If they do, what is the overall system
> health?
indeed skb_copy_expand() fail on system when it have low continuous 
memory region
when using bigger MTU.
> 
>> it should pull skb with lengh indicated by header,
>> or not it will read network data and check it as header.
>> 
>> Signed-off-by: Linyu Yuan <linyyuan@codeaurora.com>
>> ---
>>  drivers/usb/gadget/function/f_eem.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> What commit does this fix?  Should it go to stable kernels?  If so, how
> far back?
this change can't avoid all system memory issue which cause skb failure,
but i help reduce driver parse wrong network data which may consume too 
much CPU time.

i will cc stable@vger.kernel.org on V2. i think it can apply to all 
active stable branch,
from 4.4 to 5.10.

> 
> And any reason you didn't use scripts/get_maintainer.pl for who to send
> your patch to?
thanks very much, i will follow your suggestion and provide a V2.
> 
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-07  2:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 15:09 [PATCH] usb: gadget: eem: fix wrong eem header operation Linyu Yuan
2021-06-04 10:50 ` Greg KH
2021-06-07  2:27   ` linyyuan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.