* usb: gadget: add error handling for skb_realloc_headroom
@ 2018-06-12 4:41 Zhouyang Jia
0 siblings, 0 replies; 2+ messages in thread
From: Zhouyang Jia @ 2018-06-12 4:41 UTC (permalink / raw)
Cc: Zhouyang Jia, Felipe Balbi, Greg Kroah-Hartman, Bhumika Goyal,
Johan Hovold, Andrew Gabbasov, David Lechner, linux-usb,
linux-kernel
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 <jiazhouyang09@gmail.com>
---
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* usb: gadget: add error handling for skb_realloc_headroom
@ 2018-06-19 9:47 Felipe Balbi
0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2018-06-19 9:47 UTC (permalink / raw)
To: linux-usb-owner
Cc: Zhouyang Jia, Greg Kroah-Hartman, Bhumika Goyal, Johan Hovold,
Andrew Gabbasov, David Lechner, linux-usb, linux-kernel
Hi,
linux-usb-owner@vger.kernel.org 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 <jiazhouyang09@gmail.com>
From linux-usb-owner??? I can't apply this patch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-19 9:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-19 9:47 usb: gadget: add error handling for skb_realloc_headroom Felipe Balbi
-- strict thread matches above, loose matches on Subject: below --
2018-06-12 4:41 Zhouyang Jia
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).