Return-Path: Message-Id: <20130813155834.516407848@goodmis.org> Date: Tue, 13 Aug 2013 11:58:03 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mathias Nyman , Sarah Sharp , John Youn , Greg Kroah-Hartman Subject: [69/88] xhci: check for failed dma pool allocation References: <20130813155654.069291373@goodmis.org> Content-Disposition: inline; filename=0069-xhci-check-for-failed-dma-pool-allocation.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: 3.6.11.7-rc1 stable review patch. If anyone has any objections, please let me know. ------------------ From: Mathias Nyman [ Upstream commit 025f880cb2e4d7218d0422d4b07bea1a68959c38 ] 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 Signed-off-by: Sarah Sharp Cc: John Youn Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Steven Rostedt --- drivers/usb/host/xhci-mem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 419d34a..e833270 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -364,6 +364,10 @@ static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci ctx->size += CTX_SIZE(xhci->hcc_params); ctx->bytes = dma_pool_alloc(xhci->device_pool, flags, &ctx->dma); + if (!ctx->bytes) { + kfree(ctx); + return NULL; + } memset(ctx->bytes, 0, ctx->size); return ctx; } -- 1.7.10.4