summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorHarish Jenny K N <harish_kandiga@mentor.com>2016-09-09 12:30:41 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-09-09 14:49:02 +0300
commit79775f441838403be856e06eaab893a3fe9dd7b2 (patch)
treea6809b94b9d61b4e572e3a229b872bc69aa096f8 /drivers/usb/gadget
parent5387c920372a3aaeb97b8b4721619ca9ff2a82ab (diff)
downloadlinux-79775f441838403be856e06eaab893a3fe9dd7b2.tar.xz
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 <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>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/function/u_ether.c3
1 files changed, 2 insertions, 1 deletions
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;