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


Groups > linux.kernel > #1299178 > unrolled thread

[PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read callback

Started byLu Baolu <baolu.lu@linux.intel.com>
First post2015-12-30 01:50 +0100
Last post2015-12-30 06:10 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read callback Lu Baolu <baolu.lu@linux.intel.com> - 2015-12-30 01:50 +0100
    Re: [PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read  callback Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-30 02:50 +0100
      Re: [PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read  callback Lu Baolu <baolu.lu@linux.intel.com> - 2015-12-30 06:10 +0100

#1299178 — [PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read callback

FromLu Baolu <baolu.lu@linux.intel.com>
Date2015-12-30 01:50 +0100
Subject[PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
Message-ID<qLd7I-7Ke-1@gated-at.bofh.it>
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>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1299199 — Re: [PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read callback

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2015-12-30 02:50 +0100
SubjectRe: [PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
Message-ID<qLe3L-8ln-5@gated-at.bofh.it>
In reply to#1299178
On Wed, Dec 30, 2015 at 08:42:01AM +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>
> ---
>  drivers/usb/class/cdc-acm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

What changed in v2?

Please always document that below the --- line.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299239 — Re: [PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read callback

FromLu Baolu <baolu.lu@linux.intel.com>
Date2015-12-30 06:10 +0100
SubjectRe: [PATCH v2 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
Message-ID<qLhbj-24O-3@gated-at.bofh.it>
In reply to#1299199

On 12/30/2015 09:46 AM, Greg Kroah-Hartman wrote:
> On Wed, Dec 30, 2015 at 08:42:01AM +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>
>> ---
>>  drivers/usb/class/cdc-acm.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
> What changed in v2?
>
> Please always document that below the --- line.

Thank you for the reminding.

I will send a new version of patch with change logs.

> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web