USB: wdm: handle IO errors in wdm_wwan_port_start
commit 9697f5efcf5fdea65b8390b5eb81bebe746ceedc upstream.
In case submitting the URB fails we must undo
what we've done so far.
Fixes: cac6fb015f ("usb: class: cdc-wdm: WWAN framework integration")
Cc: stable <stable@kernel.org>
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20250401084749.175246-2-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3e52ae347e
commit
eb4973cf6b
@@ -829,6 +829,7 @@ static struct usb_class_driver wdm_class = {
|
||||
static int wdm_wwan_port_start(struct wwan_port *port)
|
||||
{
|
||||
struct wdm_device *desc = wwan_port_get_drvdata(port);
|
||||
int rv;
|
||||
|
||||
/* The interface is both exposed via the WWAN framework and as a
|
||||
* legacy usbmisc chardev. If chardev is already open, just fail
|
||||
@@ -848,7 +849,15 @@ static int wdm_wwan_port_start(struct wwan_port *port)
|
||||
wwan_port_txon(port);
|
||||
|
||||
/* Start getting events */
|
||||
return usb_submit_urb(desc->validity, GFP_KERNEL);
|
||||
rv = usb_submit_urb(desc->validity, GFP_KERNEL);
|
||||
if (rv < 0) {
|
||||
wwan_port_txoff(port);
|
||||
desc->manage_power(desc->intf, 0);
|
||||
/* this must be last lest we race with chardev open */
|
||||
clear_bit(WDM_WWAN_IN_USE, &desc->flags);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
static void wdm_wwan_port_stop(struct wwan_port *port)
|
||||
|
||||
Reference in New Issue
Block a user