usb: cdc-acm: fix packet loss issue
Steve Lin [Thu, 19 Jul 2012 19:36:18 +0000 (12:36 -0700)]
There is race between acm_suspend and acm_read_bulk_callback. Host may
receive bulk transfer right before suspend. The packet will be discarded
if this urb is killed in acm_suspend. This patch checks the actual length
of urb and processes it in this case.

Bug 996268

Signed-off-by: Steve Lin <stlin@nvidia.com>

Change-Id: Ief2b42708160b67903f976ec60da825d46c4720b
Reviewed-on: http://git-master/r/117135
(cherry picked from commit af3e96c987fbae8a135d1ff18872b9c32e09b67f)
Reviewed-on: http://git-master/r/118105
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Steve Lin <stlin@nvidia.com>
Reviewed-by: Steve Lin <stlin@nvidia.com>

drivers/usb/class/cdc-acm.c

index 5be18b8..60188df 100644 (file)
@@ -464,7 +464,7 @@ static void acm_read_bulk_callback(struct urb *urb)
        }
        usb_mark_last_busy(acm->dev);
 
-       if (urb->status) {
+       if (urb->status && !urb->actual_length) {
                dev_dbg(&acm->data->dev, "%s - non-zero urb status: %d\n",
                                                        __func__, urb->status);
                return;