linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Henrik Rydberg <rydberg@euromail.se>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Peter Stuge <peter@stuge.se>
Subject: Re: REGRESSION: usbdevfs: Use-scatter-gather-lists-for-large-bulk-transfers
Date: Fri, 12 Oct 2012 11:10:36 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1210121108350.1605-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20121012150800.GA3097@polaris.bitmath.org>

On Fri, 12 Oct 2012, Henrik Rydberg wrote:

> Hi Alan,
> 
> > Instead of introducing a new local variable, why not simply update 
> > uurb->buffer?  That's what we do elsewhere in the code.
> 
> It seemed fragile, due to these scary lines:
> 
> 	if (is_in && uurb->buffer_length > 0)
> 		as->userbuffer = uurb->buffer;
> 	else
> 		as->userbuffer = NULL;
> 
> I suppose it works in this particular case.  How is the
> USBDEVFS_URB_TYPE_CONTROL case supposed to work here?

It's understood that for control transfers, the setup part of the 
buffer remains unchanged.  The data transfer starts at the eighth byte 
of the buffer.

> I can certainly change the patch if preferred. Tested and attached
> below.
> 
> Thanks,
> Henrik
> 
> From 40b70394747eea51fdd07cc8213dd6afd24b1b30 Mon Sep 17 00:00:00 2001
> From: Henrik Rydberg <rydberg@euromail.se>
> Date: Thu, 11 Oct 2012 23:27:04 +0200
> Subject: [PATCH v2] usbdevfs: Fix broken scatter-gather transfer
> 
> The handling of large output bulk transfers is broken; the same user
> page is read over and over again. Fixed with this patch.
> 
> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
> ---
>  drivers/usb/core/devio.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index ebb8a9d..6e58b59 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -1349,6 +1351,7 @@
>  					goto error;
>  				}
>  			}
> +			uurb->buffer += u;
>  			totlen -= u;
>  		}
>  	} else if (uurb->buffer_length > 0) {

Acked-by: Alan Stern <stern@rowland.harvard.edu>


  reply	other threads:[~2012-10-12 15:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 20:31 REGRESSION: usbdevfs: Use-scatter-gather-lists-for-large-bulk-transfers Henrik Rydberg
2012-10-10 20:34 ` Peter Stuge
2012-10-11  5:44   ` Henrik Rydberg
2012-10-11  6:50     ` Peter Stuge
2012-10-11  6:57       ` Xiaofan Chen
2012-10-11  7:12         ` Peter Stuge
2012-10-11 21:54       ` Henrik Rydberg
2012-10-11  8:21 ` Hans de Goede
2012-10-11 21:37   ` Henrik Rydberg
2012-10-11 21:40     ` Peter Stuge
2012-10-11 21:53     ` Greg Kroah-Hartman
2012-10-12 14:11       ` Hans de Goede
2012-10-12 15:10         ` Henrik Rydberg
2012-10-12 14:25     ` Alan Stern
2012-10-12 15:08       ` Henrik Rydberg
2012-10-12 15:10         ` Alan Stern [this message]
2012-10-14 15:40         ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44L0.1210121108350.1605-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter@stuge.se \
    --cc=rydberg@euromail.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).