usbatm: fix potential NULL pointer dereference
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Fri, 19 Apr 2013 02:18:12 +0000 (10:18 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Apr 2013 17:20:41 +0000 (10:20 -0700)
The dereference to 'instance' in the debug code should be moved
below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/atm/usbatm.c

index 35f10bfe15dbff615823234e02d0e80732e7bda6..d3527dd8b90cc17e518ca5324ec517a265a8798b 100644 (file)
@@ -672,9 +672,6 @@ static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
        struct usbatm_control *ctrl = UDSL_SKB(skb);
        int err;
 
-       vdbg(&instance->usb_intf->dev, "%s called (skb 0x%p, len %u)", __func__,
-            skb, skb->len);
-
        /* racy disconnection check - fine */
        if (!instance || instance->disconnected) {
 #ifdef DEBUG
@@ -684,6 +681,9 @@ static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
                goto fail;
        }
 
+       vdbg(&instance->usb_intf->dev, "%s called (skb 0x%p, len %u)", __func__,
+            skb, skb->len);
+
        if (vcc->qos.aal != ATM_AAL5) {
                atm_rldbg(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal);
                err = -EINVAL;