* [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
@ 2015-12-30 4:59 Lu Baolu
2016-01-20 7:08 ` Tang, Jianqiang
0 siblings, 1 reply; 6+ messages in thread
From: Lu Baolu @ 2015-12-30 4:59 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
Acked-by: Oliver Neukum <oneukum@suse.com>
---
drivers/usb/class/cdc-acm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
change log:
v1->v2:
add Acked-by: Oliver Neukum <oneukum@suse.com>.
v2->v3:
add the change log.
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] 6+ messages in thread
* RE: [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
2015-12-30 4:59 [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback Lu Baolu
@ 2016-01-20 7:08 ` Tang, Jianqiang
2016-01-20 7:22 ` Lu Baolu
0 siblings, 1 reply; 6+ messages in thread
From: Tang, Jianqiang @ 2016-01-20 7:08 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Lu Baolu, Oliver Neukum
Hi Greg,
Sorry to disturb you although I know you are very busy :)
One question is about this patch, does the patch already in the process of merge into kernel?
Or need modify still?
Thanks a lot!
-----Original Message-----
From: linux-usb-owner@vger.kernel.org [mailto:linux-usb-owner@vger.kernel.org] On Behalf Of Lu Baolu
Sent: Wednesday, December 30, 2015 12:59 PM
To: Oliver Neukum <oliver@neukum.org>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; Lu Baolu <baolu.lu@linux.intel.com>; Tang, Jianqiang <jianqiang.tang@intel.com>; stable@vger.kernel.org
Subject: [PATCH v3 1/1] 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>
---
drivers/usb/class/cdc-acm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
change log:
v1->v2:
add Acked-by: Oliver Neukum <oneukum@suse.com>.
v2->v3:
add the change log.
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-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
2016-01-20 7:08 ` Tang, Jianqiang
@ 2016-01-20 7:22 ` Lu Baolu
2016-01-20 7:27 ` Tang, Jianqiang
0 siblings, 1 reply; 6+ messages in thread
From: Lu Baolu @ 2016-01-20 7:22 UTC (permalink / raw)
To: Tang, Jianqiang, Greg Kroah-Hartman
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Oliver Neukum
Hi Jianqiang,
I think you need to wait until the release of 4.5-rc1.
Thanks,
Baolu
On 01/20/2016 03:08 PM, Tang, Jianqiang wrote:
> Hi Greg,
>
> Sorry to disturb you although I know you are very busy :)
> One question is about this patch, does the patch already in the process of merge into kernel?
> Or need modify still?
>
> Thanks a lot!
>
> -----Original Message-----
> From: linux-usb-owner@vger.kernel.org [mailto:linux-usb-owner@vger.kernel.org] On Behalf Of Lu Baolu
> Sent: Wednesday, December 30, 2015 12:59 PM
> To: Oliver Neukum <oliver@neukum.org>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; Lu Baolu <baolu.lu@linux.intel.com>; Tang, Jianqiang <jianqiang.tang@intel.com>; stable@vger.kernel.org
> Subject: [PATCH v3 1/1] 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>
> ---
> drivers/usb/class/cdc-acm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> change log:
> v1->v2:
> add Acked-by: Oliver Neukum <oneukum@suse.com>.
>
> v2->v3:
> add the change log.
>
> 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-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
2016-01-20 7:22 ` Lu Baolu
@ 2016-01-20 7:27 ` Tang, Jianqiang
2016-01-20 7:33 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Tang, Jianqiang @ 2016-01-20 7:27 UTC (permalink / raw)
To: Lu Baolu, Greg Kroah-Hartman
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Oliver Neukum
Hi,
But I did not see this patch in the list of 4.5-rc1 posted by Greg.
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ tags/usb-4.5-rc1
Thanks!
-----Original Message-----
From: Lu Baolu [mailto:baolu.lu@linux.intel.com]
Sent: Wednesday, January 20, 2016 3:22 PM
To: Tang, Jianqiang <jianqiang.tang@intel.com>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; stable@vger.kernel.org; Oliver Neukum <oliver@neukum.org>
Subject: Re: [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
Hi Jianqiang,
I think you need to wait until the release of 4.5-rc1.
Thanks,
Baolu
On 01/20/2016 03:08 PM, Tang, Jianqiang wrote:
> Hi Greg,
>
> Sorry to disturb you although I know you are very busy :)
> One question is about this patch, does the patch already in the process of merge into kernel?
> Or need modify still?
>
> Thanks a lot!
>
> -----Original Message-----
> From: linux-usb-owner@vger.kernel.org [mailto:linux-usb-owner@vger.kernel.org] On Behalf Of Lu Baolu
> Sent: Wednesday, December 30, 2015 12:59 PM
> To: Oliver Neukum <oliver@neukum.org>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; Lu Baolu <baolu.lu@linux.intel.com>; Tang, Jianqiang <jianqiang.tang@intel.com>; stable@vger.kernel.org
> Subject: [PATCH v3 1/1] 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>
> ---
> drivers/usb/class/cdc-acm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> change log:
> v1->v2:
> add Acked-by: Oliver Neukum <oneukum@suse.com>.
>
> v2->v3:
> add the change log.
>
> 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-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
2016-01-20 7:27 ` Tang, Jianqiang
@ 2016-01-20 7:33 ` Greg Kroah-Hartman
2016-01-20 7:34 ` Tang, Jianqiang
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2016-01-20 7:33 UTC (permalink / raw)
To: Tang, Jianqiang
Cc: Lu Baolu, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Oliver Neukum
On Wed, Jan 20, 2016 at 07:27:13AM +0000, Tang, Jianqiang wrote:
> Hi,
> But I did not see this patch in the list of 4.5-rc1 posted by Greg.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ tags/usb-4.5-rc1
No, I can't do anything until after 4.5-rc1 is out, then I will review
this patch and apply it to the proper branch.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
2016-01-20 7:33 ` Greg Kroah-Hartman
@ 2016-01-20 7:34 ` Tang, Jianqiang
0 siblings, 0 replies; 6+ messages in thread
From: Tang, Jianqiang @ 2016-01-20 7:34 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Lu Baolu, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Oliver Neukum
Sure, thanks for your response.
Just be sure this patch will be merged.
We will wait.
Thanks!
-----Original Message-----
From: Greg Kroah-Hartman [mailto:gregkh@linuxfoundation.org]
Sent: Wednesday, January 20, 2016 3:34 PM
To: Tang, Jianqiang <jianqiang.tang@intel.com>
Cc: Lu Baolu <baolu.lu@linux.intel.com>; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; stable@vger.kernel.org; Oliver Neukum <oliver@neukum.org>
Subject: Re: [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback
On Wed, Jan 20, 2016 at 07:27:13AM +0000, Tang, Jianqiang wrote:
> Hi,
> But I did not see this patch in the list of 4.5-rc1 posted by Greg.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/
> tags/usb-4.5-rc1
No, I can't do anything until after 4.5-rc1 is out, then I will review this patch and apply it to the proper branch.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-20 7:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-30 4:59 [PATCH v3 1/1] usb: cdc-acm: handle unlinked urb in acm read callback Lu Baolu
2016-01-20 7:08 ` Tang, Jianqiang
2016-01-20 7:22 ` Lu Baolu
2016-01-20 7:27 ` Tang, Jianqiang
2016-01-20 7:33 ` Greg Kroah-Hartman
2016-01-20 7:34 ` Tang, Jianqiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox