From patchwork Thu Jan 28 18:27:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ramos Falcon, Ernesto" X-Patchwork-Id: 75600 X-Patchwork-Delegate: omar.ramirez@ti.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o0SIRtS3009518 for ; Thu, 28 Jan 2010 18:27:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755791Ab0A1S1z (ORCPT ); Thu, 28 Jan 2010 13:27:55 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754183Ab0A1S1y (ORCPT ); Thu, 28 Jan 2010 13:27:54 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:56550 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754052Ab0A1S1y convert rfc822-to-8bit (ORCPT ); Thu, 28 Jan 2010 13:27:54 -0500 Received: from dlep35.itg.ti.com ([157.170.170.118]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o0SIRrqB014406 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 28 Jan 2010 12:27:53 -0600 Received: from dlep26.itg.ti.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id o0SIRrjQ004582 for ; Thu, 28 Jan 2010 12:27:53 -0600 (CST) Received: from dlee75.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id o0SIRrND020786 for ; Thu, 28 Jan 2010 12:27:53 -0600 (CST) Received: from dlee01.ent.ti.com ([157.170.170.12]) by dlee75.ent.ti.com ([157.170.170.72]) with mapi; Thu, 28 Jan 2010 12:27:53 -0600 From: "Ramos Falcon, Ernesto" To: "linux-omap@vger.kernel.org" Date: Thu, 28 Jan 2010 12:27:50 -0600 Subject: [PATCH] DSPBRIDGE: Fix to avoid possible memory leaks in bridge driver. Thread-Topic: [PATCH] DSPBRIDGE: Fix to avoid possible memory leaks in bridge driver. Thread-Index: AcqgR5jxtVjSYqTXQGye/8KDYcXSDw== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 28 Jan 2010 18:27:55 +0000 (UTC) diff --git a/drivers/dsp/bridge/pmgr/dbll.c b/drivers/dsp/bridge/pmgr/dbll.c index 5422d21..fab749e 100644 --- a/drivers/dsp/bridge/pmgr/dbll.c +++ b/drivers/dsp/bridge/pmgr/dbll.c @@ -1347,13 +1347,14 @@ static int rmmAlloc(struct Dynamic_Loader_Allocate *this, req, segId); } } +func_cont: MEM_Free(szSectName); szSectName = NULL; MEM_Free(szLastToken); szLastToken = NULL; MEM_Free(szSecLastToken); szSecLastToken = NULL; -func_cont: + if (memType == DBLL_CODE) allocSize = info->size + GEM_L1P_PREFETCH_SIZE; else diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c index c69e3af..373bd26 100644 --- a/drivers/dsp/bridge/rmgr/drv.c +++ b/drivers/dsp/bridge/rmgr/drv.c @@ -616,7 +616,6 @@ DSP_STATUS DRV_Create(OUT struct DRV_OBJECT **phDRVObject) status = DSP_EFAIL; GT_0trace(curTrace, GT_7CLASS, "Failed to Create DRV_EXT list "); - MEM_FreeObject(pDRVObject); } else { INIT_LIST_HEAD(&pDRVObject->devNodeString-> head); @@ -626,7 +625,6 @@ DSP_STATUS DRV_Create(OUT struct DRV_OBJECT **phDRVObject) status = DSP_EMEMORY; GT_0trace(curTrace, GT_7CLASS, "Failed to Create Dev List "); - MEM_FreeObject(pDRVObject); } } else { status = DSP_EMEMORY; @@ -642,6 +640,8 @@ DSP_STATUS DRV_Create(OUT struct DRV_OBJECT **phDRVObject) pDRVObject); *phDRVObject = pDRVObject; } else { + MEM_Free(pDRVObject->devList); + MEM_Free(pDRVObject->devNodeString); /* Free the DRV Object */ MEM_Free(pDRVObject); GT_0trace(curTrace, GT_7CLASS, diff --git a/drivers/dsp/bridge/wmd/msg_sm.c b/drivers/dsp/bridge/wmd/msg_sm.c index 50201e5..974d266 100644 --- a/drivers/dsp/bridge/wmd/msg_sm.c +++ b/drivers/dsp/bridge/wmd/msg_sm.c @@ -129,8 +129,8 @@ DSP_STATUS WMD_MSG_CreateQueue(struct MSG_MGR *hMsgMgr, DSP_STATUS status = DSP_SOK; if (!MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE) || - phMsgQueue == NULL) { - status = DSP_EMEMORY; + phMsgQueue == NULL || !hMsgMgr->msgFreeList) { + status = DSP_EHANDLE; goto func_end; } @@ -177,10 +177,6 @@ DSP_STATUS WMD_MSG_CreateQueue(struct MSG_MGR *hMsgMgr, status = SYNC_OpenEvent(&pMsgQ->hSyncDoneAck, NULL); if (DSP_SUCCEEDED(status)) { - if (!hMsgMgr->msgFreeList) { - status = DSP_EHANDLE; - goto func_end; - } /* Enter critical section */ (void)SYNC_EnterCS(hMsgMgr->hSyncCS); /* Initialize message frames and put in appropriate queues */