1
linux/drivers/usb/core
Alan Stern ff9c895f07 USB: fix usbmon and DMA mapping for scatter-gather URBs
This patch (as1368) fixes a rather obscure bug in usbmon: When tracing
URBs sent by the scatter-gather library, it accesses the data buffers
while they are still mapped for DMA.

The solution is to move the mapping and unmapping out of the s-g
library and into the usual place in hcd.c.  This requires the addition
of new URB flag bits to describe the kind of mapping needed, since we
have to call dma_map_sg() if the HCD supports native scatter-gather
operation and dma_map_page() if it doesn't.  The nice thing about
having the new flags is that they simplify the testing for unmapping.

The patch removes the only caller of usb_buffer_[un]map_sg(), so those
functions are #if'ed out.  A later patch will remove them entirely.

As a result of this change, urb->sg will be set in situations where
it wasn't set previously.  Hence the xhci and whci drivers are
adjusted to test urb->num_sgs instead, which retains its original
meaning and is nonzero only when the HCD has to handle a scatterlist.

Finally, even when a submission error occurs we don't want to hand
URBs to usbmon before they are unmapped.  The submission path is
rearranged so that map_urb_for_dma() is called only for non-root-hub
URBs and unmap_urb_for_dma() is called immediately after a submission
error.  This simplifies the error handling.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 13:21:37 -07:00
..
buffer.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
config.c USB: Add a new quirk: USB_QUIRK_HONOR_BNUMINTERFACES 2010-05-20 13:21:32 -07:00
devices.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
devio.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
driver.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
endpoint.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
file.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
generic.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
hcd-pci.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
hcd.c USB: fix usbmon and DMA mapping for scatter-gather URBs 2010-05-20 13:21:37 -07:00
hub.c USB: straighten out port feature vs. port status usage 2010-05-20 13:21:31 -07:00
inode.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
Kconfig USB: fix build on OMAPs if CONFIG_PM_RUNTIME is not set 2010-04-30 09:25:11 -07:00
Makefile USB: add the usbfs devices file to debugfs 2009-06-15 21:44:43 -07:00
message.c USB: fix usbmon and DMA mapping for scatter-gather URBs 2010-05-20 13:21:37 -07:00
notify.c
otg_whitelist.h
quirks.c USB: Add a new quirk: USB_QUIRK_HONOR_BNUMINTERFACES 2010-05-20 13:21:32 -07:00
sysfs.c USB: change handling of negative autosuspend delays 2010-03-02 14:54:11 -08:00
urb.c USB: fix usbmon and DMA mapping for scatter-gather URBs 2010-05-20 13:21:37 -07:00
usb.c USB: fix usbmon and DMA mapping for scatter-gather URBs 2010-05-20 13:21:37 -07:00
usb.h USB: convert to the runtime PM framework 2010-03-02 14:54:12 -08:00