]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: cdc-phonet: fix data-interface release on probe failure
authorJohan Hovold <johan@kernel.org>
Thu, 18 Mar 2021 15:57:49 +0000 (16:57 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Mar 2021 02:45:37 +0000 (19:45 -0700)
Set the disconnected flag before releasing the data interface in case
netdev registration fails to avoid having the disconnect callback try to
deregister the never registered netdev (and trigger a WARN_ON()).

Fixes: 87cf65601e17 ("USB host CDC Phonet network interface driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cdc-phonet.c

index 02e6bbb17b15d24d8f14136882b83cc8f08986b1..8d1f69dad6031f9f9b1d9ff40f9e84daa2dc5ef3 100644 (file)
@@ -387,6 +387,8 @@ static int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *i
 
        err = register_netdev(dev);
        if (err) {
+               /* Set disconnected flag so that disconnect() returns early. */
+               pnd->disconnected = 1;
                usb_driver_release_interface(&usbpn_driver, data_intf);
                goto out;
        }