Message ID | 20191105094109.25110-2-jesse.sung@canonical.com |
---|---|
State | New |
Headers | show |
Series | Fix for libmbim-proxy using 100% CPU | expand |
On 11/5/19 1:41 AM, Wen-chien Jesse Sung wrote: > (backported from commit 8fec9355a968ad240f3a2e9ad55b823cf1cc52ff) > Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com> Acked-by: Connor Kuehl <connor.kuehl@canonical.com> > --- > drivers/usb/class/cdc-wdm.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c > index 71ad04d54212..c2e3dcfa4ccd 100644 > --- a/drivers/usb/class/cdc-wdm.c > +++ b/drivers/usb/class/cdc-wdm.c > @@ -188,7 +188,12 @@ static void wdm_in_callback(struct urb *urb) > } > } > > - desc->rerr = status; > + /* > + * Avoid propagating -EPIPE (stall) to userspace since it is > + * better handled as an empty read > + */ > + desc->rerr = (status != -EPIPE) ? status : 0; > + > if (length + desc->length > desc->wMaxCommand) { > /* The buffer would overflow */ > set_bit(WDM_OVERFLOW, &desc->flags); >
Acked-By: AceLan Kao <acelan.kao@canonical.com>
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 71ad04d54212..c2e3dcfa4ccd 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -188,7 +188,12 @@ static void wdm_in_callback(struct urb *urb) } } - desc->rerr = status; + /* + * Avoid propagating -EPIPE (stall) to userspace since it is + * better handled as an empty read + */ + desc->rerr = (status != -EPIPE) ? status : 0; + if (length + desc->length > desc->wMaxCommand) { /* The buffer would overflow */ set_bit(WDM_OVERFLOW, &desc->flags);