aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2013-06-17 12:56:33 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-21 21:21:24 -0400
commit333db1d07c454f02e008780273df44c1e3102448 (patch)
tree858a65096fa859483d716cb873e5e020a56c7a00
parent5b3e69eafcfc490dcdd0368f680170b24686abe5 (diff)
xhci: check for failed dma pool allocation
commit 025f880cb2e4d7218d0422d4b07bea1a68959c38 upstream. Fail and free the container context in case dma_pool_alloc() can't allocate the raw context data part of it This patch should be backported to kernels as old as 2.6.31, that contain the commit d115b04818e57bdbc7ccde4d0660b15e33013dc8 "USB: xhci: Support for 64-byte contexts". Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: John Youn <johnyoun@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci-mem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index fbf75e57628b..f2e57a1112c9 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -369,6 +369,10 @@ static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci
369 ctx->size += CTX_SIZE(xhci->hcc_params); 369 ctx->size += CTX_SIZE(xhci->hcc_params);
370 370
371 ctx->bytes = dma_pool_alloc(xhci->device_pool, flags, &ctx->dma); 371 ctx->bytes = dma_pool_alloc(xhci->device_pool, flags, &ctx->dma);
372 if (!ctx->bytes) {
373 kfree(ctx);
374 return NULL;
375 }
372 memset(ctx->bytes, 0, ctx->size); 376 memset(ctx->bytes, 0, ctx->size);
373 return ctx; 377 return ctx;
374} 378}