diff options
author | Seshendra Gadagottu <sgadagottu@nvidia.com> | 2012-03-03 09:33:14 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 01:14:59 -0700 |
commit | 5b8a4d9a3f2da9bf31315fb187436275c5633f5e (patch) | |
tree | 82f94ce44ed3a46fc8007deed0bf0eb23cff7216 /drivers/usb/class/cdc-acm.c | |
parent | ee2a1064bd206e63c87c85882aff8863260e0b69 (diff) |
usb: cdc-acm: Add acm handle validity check
Added check for acm handle validity before doing any action
in acm_suspend, acm_resume and acm_reset_resume functions.
Bug 939237
Change-Id: Idc5d7db6bd405056a90b85009825ccbd03547757
Signed-off-by: Seshendra Gadagottu<sgadagottu@nvidia.com>
Reviewed-on: http://git-master/r/83413
(cherry picked from commit 1dd9736cd2df12c0315a44c95010cb64eee04050)
Reviewed-on: http://git-master/r/87504
Reviewed-by: Steve Lin <stlin@nvidia.com>
Rebase-Id: R21b7927e34e58ae75dbe32668033505525606ed2
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 0c4e24be5569..34c238b62790 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -1388,6 +1388,11 @@ static void stop_data_traffic(struct acm *acm) { int i; + if (!acm) { + pr_err("%s: !acm\n", __func__); + return; + } + dev_dbg(&acm->control->dev, "%s\n", __func__); usb_kill_urb(acm->ctrlurb); @@ -1458,6 +1463,11 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message) struct acm *acm = usb_get_intfdata(intf); int cnt; + if (!acm) { + pr_err("%s: !acm\n", __func__); + return -ENODEV; + } + if (PMSG_IS_AUTO(message)) { int b; @@ -1494,6 +1504,11 @@ static int acm_resume(struct usb_interface *intf) struct acm_wb *wb; #endif + if (!acm) { + pr_err("%s: !acm\n", __func__); + return -ENODEV; + } + spin_lock_irq(&acm->read_lock); acm->susp_count -= 1; cnt = acm->susp_count; @@ -1545,6 +1560,11 @@ static int acm_reset_resume(struct usb_interface *intf) { struct acm *acm = usb_get_intfdata(intf); + if (!acm) { + pr_err("%s: !acm\n", __func__); + return -ENODEV; + } + if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags)) { tty = tty_port_tty_get(&acm->port); if (tty) { |