summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorAndrea Righi <arighi@develer.com>2010-06-28 16:56:45 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 14:35:38 -0700
commit4307a28eb0128417d9a2b9d858d2bce70ee5b383 (patch)
tree46efab423c646ba4a994533b1e5befe523fbf08a /drivers/usb/core
parente10fa4787f1fb9c8738dff955c272f30b7b63134 (diff)
downloadop-kernel-dev-4307a28eb0128417d9a2b9d858d2bce70ee5b383.zip
op-kernel-dev-4307a28eb0128417d9a2b9d858d2bce70ee5b383.tar.gz
USB: EHCI: fix NULL pointer dererence in HCDs that use HCD_LOCAL_MEM
If we use the HCD_LOCAL_MEM flag and dma_declare_coherent_memory() to enforce the host controller's local memory utilization we also need to disable native scatter-gather support, otherwise hcd_alloc_coherent() in map_urb_for_dma() is called with urb->transfer_buffer == NULL, that triggers a NULL pointer dereference. We can also consider to add a WARN_ON() and return an error code to better catch this problem in the future. At the moment no driver seems to hit this bug, so I should consider this a low-priority fix. Signed-off-by: Andrea Righi <arighi@develer.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/hcd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 0358c05..c5753c7 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1218,6 +1218,11 @@ static int hcd_alloc_coherent(struct usb_bus *bus,
{
unsigned char *vaddr;
+ if (*vaddr_handle == NULL) {
+ WARN_ON_ONCE(1);
+ return -EFAULT;
+ }
+
vaddr = hcd_buffer_alloc(bus, size + sizeof(vaddr),
mem_flags, dma_handle);
if (!vaddr)
OpenPOWER on IntegriCloud