aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2012-09-12 16:44:35 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-13 16:11:51 -0400
commit8624dd2a3e33b647cd672211b54ba276ddee2a2c (patch)
tree16528920c6b0be93b4b6927680fa49dd1dcb13b8 /drivers/net
parentba1bf474eae07a128fae6252bf7d68eaef0eacf8 (diff)
net: qmi_wwan: call subdriver with control intf only
This fixes a hang on suspend due to calling wdm_suspend on the unregistered data interface. The hang should have been a NULL pointer reference had it not been for a logic error in the cdc_wdm code. commit 230718bd net: qmi_wwan: bind to both control and data interface changed qmi_wwan to use cdc_wdm as a subdriver for devices with a two-interface QMI/wwan function. The commit failed to update qmi_wwan_suspend and qmi_wwan_resume, which were written to handle either a single combined interface function, or no subdriver at all. The result was that we called into the subdriver both when the control interface was suspended and when the data interface was suspended. Calling the subdriver suspend function with an unregistered interface is not supported and will make the subdriver bug out. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/usb/qmi_wwan.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 17b8f3e37687..b1ba68f1a049 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -297,7 +297,7 @@ static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message)
297 if (ret < 0) 297 if (ret < 0)
298 goto err; 298 goto err;
299 299
300 if (info->subdriver && info->subdriver->suspend) 300 if (intf == info->control && info->subdriver && info->subdriver->suspend)
301 ret = info->subdriver->suspend(intf, message); 301 ret = info->subdriver->suspend(intf, message);
302 if (ret < 0) 302 if (ret < 0)
303 usbnet_resume(intf); 303 usbnet_resume(intf);
@@ -310,13 +310,14 @@ static int qmi_wwan_resume(struct usb_interface *intf)
310 struct usbnet *dev = usb_get_intfdata(intf); 310 struct usbnet *dev = usb_get_intfdata(intf);
311 struct qmi_wwan_state *info = (void *)&dev->data; 311 struct qmi_wwan_state *info = (void *)&dev->data;
312 int ret = 0; 312 int ret = 0;
313 bool callsub = (intf == info->control && info->subdriver && info->subdriver->resume);
313 314
314 if (info->subdriver && info->subdriver->resume) 315 if (callsub)
315 ret = info->subdriver->resume(intf); 316 ret = info->subdriver->resume(intf);
316 if (ret < 0) 317 if (ret < 0)
317 goto err; 318 goto err;
318 ret = usbnet_resume(intf); 319 ret = usbnet_resume(intf);
319 if (ret < 0 && info->subdriver && info->subdriver->resume && info->subdriver->suspend) 320 if (ret < 0 && callsub && info->subdriver->suspend)
320 info->subdriver->suspend(intf, PMSG_SUSPEND); 321 info->subdriver->suspend(intf, PMSG_SUSPEND);
321err: 322err:
322 return ret; 323 return ret;