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