linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: add error handling for skb_realloc_headroom
@ 2018-06-12  4:41 Zhouyang Jia
  2018-06-19  9:47 ` Felipe Balbi
  2018-06-19 12:23 ` [PATCH v2] " Zhouyang Jia
  0 siblings, 2 replies; 4+ 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);
-- 
2.7.4


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

* Re: [PATCH] usb: gadget: add error handling for skb_realloc_headroom
  2018-06-12  4:41 [PATCH] usb: gadget: add error handling for skb_realloc_headroom Zhouyang Jia
@ 2018-06-19  9:47 ` Felipe Balbi
  2018-06-19 12:23 ` [PATCH v2] " Zhouyang Jia
  1 sibling, 0 replies; 4+ 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

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]


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.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [PATCH v2] usb: gadget: add error handling for skb_realloc_headroom
  2018-06-12  4:41 [PATCH] usb: gadget: add error handling for skb_realloc_headroom Zhouyang Jia
  2018-06-19  9:47 ` Felipe Balbi
@ 2018-06-19 12:23 ` Zhouyang Jia
  2018-06-29  6:36   ` Felipe Balbi
  1 sibling, 1 reply; 4+ 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);
-- 
2.7.4


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

* Re: [PATCH v2] usb: gadget: add error handling for skb_realloc_headroom
  2018-06-19 12:23 ` [PATCH v2] " Zhouyang Jia
@ 2018-06-29  6:36   ` Felipe Balbi
  0 siblings, 0 replies; 4+ 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??

-- 
balbi

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

end of thread, other threads:[~2018-06-29  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12  4:41 [PATCH] usb: gadget: add error handling for skb_realloc_headroom Zhouyang Jia
2018-06-19  9:47 ` Felipe Balbi
2018-06-19 12:23 ` [PATCH v2] " Zhouyang Jia
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).