summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2016-08-11 15:51:45 +0800
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-08-22 10:45:12 +0300
commit70237dc8efd092b93b40dc2eba812d66a5d65cb1 (patch)
treea9dba2adcd5250db36cdd56cf47fab49c8aab3dd /drivers/usb
parent3295235fd70ed6d594aadee8c892a14f6a4b2d2e (diff)
downloadlinux-70237dc8efd092b93b40dc2eba812d66a5d65cb1.tar.bz2
usb: gadget: function: f_eem: socket buffer may be NULL
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_eem.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c
index d58bfc32be9e..8741fd740174 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -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.