Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1476573 > unrolled thread

[PATCH] usb: gadget: prevent potenial null pointer dereference on skb->len

Started byColin King <colin.king@canonical.com>
First post2016-09-05 17:40 +0200
Last post2016-09-06 04:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] usb: gadget: prevent potenial null pointer dereference on skb->len Colin King <colin.king@canonical.com> - 2016-09-05 17:40 +0200
    RE: [PATCH] usb: gadget: prevent potenial null pointer dereference on  skb->len Peter Chen <peter.chen@nxp.com> - 2016-09-06 04:10 +0200

#1476573 — [PATCH] usb: gadget: prevent potenial null pointer dereference on skb->len

FromColin King <colin.king@canonical.com>
Date2016-09-05 17:40 +0200
Subject[PATCH] usb: gadget: prevent potenial null pointer dereference on skb->len
Message-ID<se4a6-5AV-25@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

An earlier fix partially fixed the null pointer dereference on skb->len
by moving the assignment of len after the check on skb being non-null,
however it failed to remove the erroneous dereference when assigning len.
Correctly fix this by removing the initialisation of len as was
originally intended.

Fixes: 70237dc8efd092 ("usb: gadget: function: f_eem: socket buffer may be NULL")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/usb/gadget/function/f_eem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c
index 8741fd7..007ec6e 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -342,7 +342,7 @@ static struct sk_buff *eem_wrap(struct gether *port, struct sk_buff *skb)
 	struct sk_buff	*skb2 = NULL;
 	struct usb_ep	*in = port->in_ep;
 	int		headroom, tailroom, padlen = 0;
-	u16		len = skb->len;
+	u16		len;
 
 	if (!skb)
 		return NULL;
-- 
2.9.3

[toc] | [next] | [standalone]


#1477018 — RE: [PATCH] usb: gadget: prevent potenial null pointer dereference on skb->len

FromPeter Chen <peter.chen@nxp.com>
Date2016-09-06 04:10 +0200
SubjectRE: [PATCH] usb: gadget: prevent potenial null pointer dereference on skb->len
Message-ID<sedZL-3RL-3@gated-at.bofh.it>
In reply to#1476573
 
>
>From: Colin Ian King <colin.king@canonical.com>
>
>An earlier fix partially fixed the null pointer dereference on skb->len by moving the
>assignment of len after the check on skb being non-null, however it failed to remove
>the erroneous dereference when assigning len.
>Correctly fix this by removing the initialisation of len as was originally intended.
>
>Fixes: 70237dc8efd092 ("usb: gadget: function: f_eem: socket buffer may be NULL")
>Signed-off-by: Colin Ian King <colin.king@canonical.com>
>---
> drivers/usb/gadget/function/f_eem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c
>index 8741fd7..007ec6e 100644
>--- a/drivers/usb/gadget/function/f_eem.c
>+++ b/drivers/usb/gadget/function/f_eem.c
>@@ -342,7 +342,7 @@ static struct sk_buff *eem_wrap(struct gether *port, struct
>sk_buff *skb)
> 	struct sk_buff	*skb2 = NULL;
> 	struct usb_ep	*in = port->in_ep;
> 	int		headroom, tailroom, padlen = 0;
>-	u16		len = skb->len;
>+	u16		len;
>
> 	if (!skb)
> 		return NULL;

Sorry, my careless, Thanks for fixing it.

Acked-by: Peter Chen <peter.chen@nxp.com>

Peter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web