Patchwork [3.8.y.z,extended,stable] Patch "xhci: check for failed dma pool allocation" has been added to staging queue

mail settings
Submitter Luis Henriques
Date July 9, 2013, 4:28 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/257774/
State New
Headers show


Luis Henriques - July 9, 2013, 4:28 p.m.
This is a note to let you know that I have just added a patch titled

    xhci: check for failed dma pool allocation

to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.8.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.8.y.z tree, see



From 30dcb1b770a10f730738b177ca403a4058bc2995 Mon Sep 17 00:00:00 2001
From: Mathias Nyman <>
Date: Mon, 17 Jun 2013 09:56:33 -0700
Subject: [PATCH] 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 <>
Signed-off-by: Sarah Sharp <>
Cc: John Youn <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: Luis Henriques <>
 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 0618f25..1ffbbfb 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
 		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;