Skip to content

Commit

Permalink
usb: gadget: function: f_eem: socket buffer may be NULL
Browse files Browse the repository at this point in the history
In eth_start_xmit, the socket buffer may be NULL. So, add NULL pointer
check at .wrap API.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Peter Chen authored and Felipe Balbi committed Aug 22, 2016
1 parent 3295235 commit 70237dc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/usb/gadget/function/f_eem.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,15 @@ 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 padlen = 0;
int headroom, tailroom, padlen = 0;
u16 len = skb->len;

int headroom = skb_headroom(skb);
int tailroom = skb_tailroom(skb);
if (!skb)
return NULL;

len = skb->len;
headroom = skb_headroom(skb);
tailroom = skb_tailroom(skb);

/* When (len + EEM_HLEN + ETH_FCS_LEN) % in->maxpacket) is 0,
* stick two bytes of zero-length EEM packet on the end.
Expand Down

0 comments on commit 70237dc

Please sign in to comment.