summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYu-An Shih <yshih@nvidia.com>2014-01-08 11:35:25 +0800
committerMartin Chi <mchi@nvidia.com>2014-01-14 20:28:48 -0800
commit2f521a8d99cbdb106a0f36c345e69b86b89d35c7 (patch)
treee17a7f64837c3dfe571917c401aeea178fa6907f /drivers
parent05a48d44be5117c1858dd42499cdf57ed15cbeb4 (diff)
USB: cdc-acm: fix data reordering issue
There is a race condition between acm_tty_unthrottle and acm_process_read_urb; new data can be added to the tty buffer before the data queued when throttled. Bug 1436086 Change-Id: I76364cc69fb718e34ae646497591ddc8a717e6e1 Signed-off-by: Yu-An Shih <yshih@nvidia.com> Reviewed-on: http://git-master/r/353617 (cherry picked from commit 381e5c6d0bc2f3a5eb266b5a54d83d491cbac20d) (cherry picked from commit ee96ff10770213e6376027556efe8a5959f61320) Reviewed-on: http://git-master/r/355823 Reviewed-by: Gray Lei <glei@nvidia.com> Tested-by: Gray Lei <glei@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Martin Chi <mchi@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/class/cdc-acm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index cbcfda6e4393..626a9a0d0547 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -836,10 +836,8 @@ static void acm_tty_unthrottle(struct tty_struct *tty)
acm->int_throttled = 0;
acm->throttled = 0;
acm->throttle_req = 0;
- spin_unlock_irq(&acm->read_lock);
if (was_throttled) {
- spin_lock_irq(&acm->read_lock);
while (!list_empty(&acm->rb_head)) {
struct acm_rb *rb = list_entry(acm->rb_head.next,
struct acm_rb, rb_node);
@@ -861,6 +859,8 @@ static void acm_tty_unthrottle(struct tty_struct *tty)
if (!acm->int_throttled)
acm_submit_read_urbs(acm, GFP_KERNEL);
+ } else {
+ spin_unlock_irq(&acm->read_lock);
}
}