staging: line6: do not return 0 from probe if no initialization done
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Tue, 10 Jun 2014 20:22:50 +0000 (00:22 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Jun 2014 00:12:01 +0000 (17:12 -0700)
There is a strange "return 0" in line6_probe() before any initialization of
the module is done. It can lead to NULL pointer dereference in other functions.
The patch proposes to return -ENODEV in this case.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/line6/driver.c

index ef511c76a6e36eac338098f6209fd7af39856d44..503b2d763595fb02c55b5a5d4bd234463e1164cf 100644 (file)
@@ -663,7 +663,7 @@ static int line6_probe(struct usb_interface *interface,
        case LINE6_DEVID_POCKETPOD:
                switch (interface_number) {
                case 0:
-                       return 0;       /* this interface has no endpoints */
+                       return -ENODEV; /* this interface has no endpoints */
                case 1:
                        alternate = 0;
                        break;