Skip to content

Commit

Permalink
usb: gadget: prevent potenial null pointer dereference on skb->len
Browse files Browse the repository at this point in the history
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: 70237dc ("usb: gadget: function: f_eem: socket buffer may be NULL")
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Colin Ian King authored and Felipe Balbi committed Sep 6, 2016
1 parent 519d8bd commit 3ff488a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/gadget/function/f_eem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3ff488a

Please sign in to comment.