From: Harish Jenny K N Date: Fri, 9 Sep 2016 09:30:41 +0000 (+0200) Subject: usb: gadget: u_ether: fix another dereference after null check X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=79775f441838403be856e06eaab893a3fe9dd7b2;p=deliverable%2Flinux.git usb: gadget: u_ether: fix another dereference after null check 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 Signed-off-by: Harish Jenny K N Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index 3be4b93fd415..9c8c9ed1dc9e 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -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;