2018-06-12 04:42:44

by Zhouyang Jia

[permalink] [raw]
Subject: [PATCH] usb: gadget: add error handling for skb_realloc_headroom

When skb_realloc_headroom fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling skb_realloc_headroom.

Signed-off-by: Zhouyang Jia <[email protected]>
---
drivers/usb/gadget/function/f_rndis.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
index d48df36..17c164b 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -374,6 +374,9 @@ static struct sk_buff *rndis_add_header(struct gether *port,
return NULL;

skb2 = skb_realloc_headroom(skb, sizeof(struct rndis_packet_msg_type));
+ if (!skb2)
+ return NULL;
+
rndis_add_hdr(skb2);

dev_kfree_skb(skb);
--
2.7.4



2018-06-19 09:51:02

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH] usb: gadget: add error handling for skb_realloc_headroom


Hi,

[email protected] writes:
> When skb_realloc_headroom fails, the lack of error-handling code may
> cause unexpected results.
>
> This patch adds error-handling code after calling skb_realloc_headroom.
>
> Signed-off-by: Zhouyang Jia <[email protected]>

From linux-usb-owner??? I can't apply this patch.

--
balbi


Attachments:
signature.asc (847.00 B)

2018-06-19 12:24:13

by Zhouyang Jia

[permalink] [raw]
Subject: [PATCH v2] usb: gadget: add error handling for skb_realloc_headroom

When skb_realloc_headroom fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling skb_realloc_headroom.

Signed-off-by: Zhouyang Jia <[email protected]>
---
drivers/usb/gadget/function/f_rndis.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
index d48df36..17c164b 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -374,6 +374,9 @@ static struct sk_buff *rndis_add_header(struct gether *port,
return NULL;

skb2 = skb_realloc_headroom(skb, sizeof(struct rndis_packet_msg_type));
+ if (!skb2)
+ return NULL;
+
rndis_add_hdr(skb2);

dev_kfree_skb(skb);
--
2.7.4


2018-06-29 07:19:33

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2] usb: gadget: add error handling for skb_realloc_headroom


Hi,

[email protected] writes:

> When skb_realloc_headroom fails, the lack of error-handling code may
> cause unexpected results.
>
> This patch adds error-handling code after calling skb_realloc_headroom.
>
> Signed-off-by: Zhouyang Jia <[email protected]>

from [email protected]??

--
balbi