skb is checked for null pointer at above code, so skb might be null.
eem_wrap uses it without checking null pointer, fix it by adding null
pointer check.

Signed-off-by: Peter Chen <peter.c...@nxp.com>
---
 drivers/usb/gadget/function/u_ether.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/u_ether.c 
b/drivers/usb/gadget/function/u_ether.c
index 5f562c1..2bc8823 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -549,7 +549,7 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
                unsigned long   flags;
 
                spin_lock_irqsave(&dev->lock, flags);
-               if (dev->port_usb)
+               if (dev->port_usb && skb)
                        skb = dev->wrap(dev->port_usb, skb);
                spin_unlock_irqrestore(&dev->lock, flags);
                if (!skb) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to