]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net: hso: bail out on interrupt URB allocation failure
authorJohan Hovold <johan@kernel.org>
Wed, 19 May 2021 12:47:17 +0000 (14:47 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Thu, 15 Jul 2021 17:23:04 +0000 (19:23 +0200)
BugLink: https://bugs.launchpad.net/bugs/1931896
commit 4d52ebc7ace491d58f96d1f4a1cb9070c506b2e7 upstream.

Commit 31db0dbd7244 ("net: hso: check for allocation failure in
hso_create_bulk_serial_device()") recently started returning an error
when the driver fails to allocate resources for the interrupt endpoint
and tiocmget functionality.

For consistency let's bail out from probe also if the URB allocation
fails.

Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/net/usb/hso.c

index 88f87787833cc33fce5c43c541838a9eb331c85b..fbfcbd0dcfcbc9b836b690365535fdb67347bfce 100644 (file)
@@ -2635,14 +2635,14 @@ static struct hso_device *hso_create_bulk_serial_device(
                }
 
                tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
-               if (tiocmget->urb) {
-                       mutex_init(&tiocmget->mutex);
-                       init_waitqueue_head(&tiocmget->waitq);
-               } else
-                       hso_free_tiomget(serial);
-       }
-       else
+               if (!tiocmget->urb)
+                       goto exit;
+
+               mutex_init(&tiocmget->mutex);
+               init_waitqueue_head(&tiocmget->waitq);
+       } else {
                num_urbs = 1;
+       }
 
        if (hso_serial_common_create(serial, num_urbs, BULK_URB_RX_SIZE,
                                     BULK_URB_TX_SIZE))