diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2013-06-17 09:56:33 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-18 10:53:54 -0700 |
commit | 025f880cb2e4d7218d0422d4b07bea1a68959c38 (patch) | |
tree | 45c4268d69df2830ee2ad4bdfcbfc7a2b57ca481 /drivers/usb/host/xhci-mem.c | |
parent | 45778ff4dab7e5f26ace74f7289c6f377d772c99 (diff) | |
download | blackbird-op-linux-025f880cb2e4d7218d0422d4b07bea1a68959c38.tar.gz blackbird-op-linux-025f880cb2e4d7218d0422d4b07bea1a68959c38.zip |
xhci: check for failed dma pool allocation
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>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r-- | drivers/usb/host/xhci-mem.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index b0d789e31f96..df6978abd7e6 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -373,6 +373,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; } |