Skip to content

Commit 1945446

Browse files
LuBaolugregkh
authored andcommitted
usb: cdc-acm: handle unlinked urb in acm read callback
In current acm driver, the bulk-in callback function ignores the URBs unlinked in usb core. This causes unexpected data loss in some cases. For example, runtime suspend entry will unlinked all urbs and set urb->status to -ENOENT even those urbs might have data not processed yet. Hence, data loss occurs. This patch lets bulk-in callback function handle unlinked urbs to avoid data loss. Signed-off-by: Tang Jian Qiang <jianqiang.tang@intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Cc: stable@vger.kernel.org Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 92e963f commit 1945446

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/usb/class/cdc-acm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ static void acm_read_bulk_callback(struct urb *urb)
428428
set_bit(rb->index, &acm->read_urbs_free);
429429
dev_dbg(&acm->data->dev, "%s - non-zero urb status: %d\n",
430430
__func__, status);
431-
return;
431+
if ((status != -ENOENT) || (urb->actual_length == 0))
432+
return;
432433
}
433434

434435
usb_mark_last_busy(acm->dev);

0 commit comments

Comments
 (0)