linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
@ 2015-12-29  5:46 Lu Baolu
  2015-12-29 13:26 ` Oliver Neukum
  0 siblings, 1 reply; 2+ messages in thread
From: Lu Baolu @ 2015-12-29  5:46 UTC (permalink / raw)
  To: Oliver Neukum, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Lu Baolu, Tang Jian Qiang, stable

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
---
 drivers/usb/class/cdc-acm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 26ca4f9..8cd193b 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -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);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
  2015-12-29  5:46 [PATCH 1/1] usb: cdc-acm: handle unlinked urb in acm read callback Lu Baolu
@ 2015-12-29 13:26 ` Oliver Neukum
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2015-12-29 13:26 UTC (permalink / raw)
  To: Lu Baolu
  Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, Tang Jian Qiang, stable

On Tue, 2015-12-29 at 13:46 +0800, Lu Baolu wrote:
> 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>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-29 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-29  5:46 [PATCH 1/1] usb: cdc-acm: handle unlinked urb in acm read callback Lu Baolu
2015-12-29 13:26 ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).