From: Zhouyang Jia <jiazhouyang09@gmail.com>
Cc: Zhouyang Jia <jiazhouyang09@gmail.com>,
Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Bhumika Goyal <bhumirks@gmail.com>,
Johan Hovold <johan@kernel.org>,
Andrew Gabbasov <andrew_gabbasov@mentor.com>,
David Lechner <david@lechnology.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: usb: gadget: add error handling for skb_realloc_headroom
Date: Tue, 12 Jun 2018 12:41:41 +0800 [thread overview]
Message-ID: <1528778503-41615-1-git-send-email-jiazhouyang09@gmail.com> (raw)
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);
next reply other threads:[~2018-06-12 4:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 4:41 Zhouyang Jia [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-06-19 9:47 usb: gadget: add error handling for skb_realloc_headroom Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1528778503-41615-1-git-send-email-jiazhouyang09@gmail.com \
--to=jiazhouyang09@gmail.com \
--cc=andrew_gabbasov@mentor.com \
--cc=balbi@kernel.org \
--cc=bhumirks@gmail.com \
--cc=david@lechnology.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).