summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2015-11-21 00:36:44 +0300
committerSasha Levin <sasha.levin@oracle.com>2016-01-22 12:24:45 -0500
commita4e9e566beca4e3adbc8689bb5b583cd385572ea (patch)
tree8a997e79a62aabdcee83ed41feb39119520279ba
parent782f17fde163a785e9bea86605aaab540f831bd8 (diff)
downloadlwn-a4e9e566beca4e3adbc8689bb5b583cd385572ea.tar.gz
lwn-a4e9e566beca4e3adbc8689bb5b583cd385572ea.zip
USB: whci-hcd: add check for dma mapping error
[ Upstream commit f9fa1887dcf26bd346665a6ae3d3f53dec54cba1 ] qset_fill_page_list() do not check for dma mapping errors. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r--drivers/usb/host/whci/qset.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c
index dc31c425ce01..9f1c0538b211 100644
--- a/drivers/usb/host/whci/qset.c
+++ b/drivers/usb/host/whci/qset.c
@@ -377,6 +377,10 @@ static int qset_fill_page_list(struct whc *whc, struct whc_std *std, gfp_t mem_f
if (std->pl_virt == NULL)
return -ENOMEM;
std->dma_addr = dma_map_single(whc->wusbhc.dev, std->pl_virt, pl_len, DMA_TO_DEVICE);
+ if (dma_mapping_error(whc->wusbhc.dev, std->dma_addr)) {
+ kfree(std->pl_virt);
+ return -EFAULT;
+ }
for (p = 0; p < std->num_pointers; p++) {
std->pl_virt[p].buf_ptr = cpu_to_le64(dma_addr);