]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
usb: chipidea: udc: fix memory leak in _ep_nuke
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Thu, 4 Apr 2013 10:13:47 +0000 (13:13 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2013 03:08:18 +0000 (20:08 -0700)
commit 7ca2cd291fd84ae499390f227a255ccba2780a81 upstream.

In hardware_enqueue code adds one extra td with dma_pool_alloc if
mReq->req.zero is true. When _ep_nuke will be called for that endpoint,
dma_pool_free will not be called to free that memory again. That patch
fixes this.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/udc.c

index c2f32369ef2b04917b8afd2a723feaac1dc5a01a..c0f40663bed7584bb3e9a2f487402a5a3d020b6b 100644 (file)
@@ -563,6 +563,12 @@ __acquires(mEp->lock)
                struct ci13xxx_req *mReq = \
                        list_entry(mEp->qh.queue.next,
                                   struct ci13xxx_req, queue);
+
+               if (mReq->zptr) {
+                       dma_pool_free(mEp->td_pool, mReq->zptr, mReq->zdma);
+                       mReq->zptr = NULL;
+               }
+
                list_del_init(&mReq->queue);
                mReq->req.status = -ESHUTDOWN;