]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: gadget: u_ether: fix another dereference after null check
authorHarish Jenny K N <harish_kandiga@mentor.com>
Fri, 9 Sep 2016 09:30:41 +0000 (11:30 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 9 Sep 2016 11:49:02 +0000 (14:49 +0300)
dev->port_usb is checked for null pointer previously, so dev->port_usb
might be null during no zlp check, fix it by adding null pointer check.

Acked-by: Jim Baxter <jim_baxter@mentor.com>
Signed-off-by: Harish Jenny K N <harish_kandiga@mentor.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/u_ether.c

index 3be4b93fd415f56cbf8cfadf68abdc55d517ee45..9c8c9ed1dc9e0b2186e60e66488ea1159f22d7b8 100644 (file)
@@ -571,7 +571,8 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
        req->complete = tx_complete;
 
        /* NCM requires no zlp if transfer is dwNtbInMaxSize */
-       if (dev->port_usb->is_fixed &&
+       if (dev->port_usb &&
+           dev->port_usb->is_fixed &&
            length == dev->port_usb->fixed_in_len &&
            (length % in->maxpacket) == 0)
                req->zero = 0;