usb: gadget: function: f_rndis: socket buffer may be NULL
authorPeter Chen <peter.chen@nxp.com>
Thu, 11 Aug 2016 07:51:46 +0000 (15:51 +0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 22 Aug 2016 07:45:12 +0000 (10:45 +0300)
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>
drivers/usb/gadget/function/f_rndis.c

index c8005823b1905389710d2839249766939eff10b1..16562e46112179b419a353a6508b6629c7d10d7e 100644 (file)
@@ -374,6 +374,9 @@ static struct sk_buff *rndis_add_header(struct gether *port,
 {
        struct sk_buff *skb2;
 
+       if (!skb)
+               return NULL;
+
        skb2 = skb_realloc_headroom(skb, sizeof(struct rndis_packet_msg_type));
        rndis_add_hdr(skb2);