Skip to content

Commit

Permalink
usb: cdc-acm: handle unlinked urb in acm read callback
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Lu Baolu <[email protected]>
Cc: [email protected]
Acked-by: Oliver Neukum <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
LuBaolu authored and gregkh committed Jan 25, 2016
1 parent 92e963f commit 1945446
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/class/cdc-acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ static void acm_read_bulk_callback(struct urb *urb)
set_bit(rb->index, &acm->read_urbs_free);
dev_dbg(&acm->data->dev, "%s - non-zero urb status: %d\n",
__func__, status);
return;
if ((status != -ENOENT) || (urb->actual_length == 0))
return;
}

usb_mark_last_busy(acm->dev);
Expand Down

0 comments on commit 1945446

Please sign in to comment.