Re: [PATCH 3/7] USB: add direction bit to urb->transfer_flags

Pete Zaitcev <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Red Hat, Inc.
Message-ID <[email protected]>
On Mon, 30 Jul 2007 17:06:16 -0400 (EDT), Alan Stern <[email protected]> wrote:

> --- usb-2.6.orig/drivers/usb/core/urb.c
> +++ usb-2.6/drivers/usb/core/urb.c
> @@ -309,7 +309,21 @@ int usb_submit_urb(struct urb *urb, gfp_
>  	xfertype = usb_endpoint_type(&ep->desc);
> -	is_out = usb_pipeout(urb->pipe);
> +	if (xfertype == USB_ENDPOINT_XFER_CONTROL) {
> +		struct usb_ctrlrequest *setup =
> +				(struct usb_ctrlrequest *) urb->setup_packet;
> +
> +		if (!setup)
> +			return -ENOEXEC;

I welcome this. I should be able to rip some code out of usbmon now.

The comment in usb.h says:
 *  (Note
 * that transfer_buffer and setup_packet must still be set because not all
 * host controllers use DMA, nor do virtual root hubs).

But in case of data, this happens when a driver attempts to set up DMA
with a highmem page without doing a kmap first. I think we never enforced
the above comment. And I think that I managed to oops usbmon by dereferencing
garbage in transfer_buffer before but I may not remember right.
But the setup packet should be mapped to be used, right? There's no
good reason for setup_packet not to be mapped, right?

-- Pete

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.