Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1333989 > unrolled thread

[PATCH 4.4 068/117] usb: cdc-acm: handle unlinked urb in acm read callback

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2016-02-15 01:30 +0100
Last post2016-02-15 01:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.4 068/117] usb: cdc-acm: handle unlinked urb in acm read callback Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-02-15 01:30 +0100

#1333989 — [PATCH 4.4 068/117] usb: cdc-acm: handle unlinked urb in acm read callback

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-02-15 01:30 +0100
Subject[PATCH 4.4 068/117] usb: cdc-acm: handle unlinked urb in acm read callback
Message-ID<r2fd8-1KG-23@gated-at.bofh.it>
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lu Baolu <baolu.lu@linux.intel.com>

commit 19454462acb1bdef80542061bdc9b410e4ed1ff6 upstream.

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>
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/class/cdc-acm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -428,7 +428,8 @@ static void acm_read_bulk_callback(struc
 		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);

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web