From patchwork Thu Feb 18 14:40:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ameya Palande X-Patchwork-Id: 80310 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 o1IEftus032040 for ; Thu, 18 Feb 2010 14:41:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757642Ab0BROly (ORCPT ); Thu, 18 Feb 2010 09:41:54 -0500 Received: from smtp.nokia.com ([192.100.122.230]:36534 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757619Ab0BROly (ORCPT ); Thu, 18 Feb 2010 09:41:54 -0500 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1IEfd8u018787; Thu, 18 Feb 2010 16:41:47 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Feb 2010 16:41:42 +0200 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Feb 2010 16:41:42 +0200 Received: from localhost.localdomain (esdhcp041123.research.nokia.com [172.21.41.123]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1IEfUBJ019957; Thu, 18 Feb 2010 16:41:37 +0200 From: Ameya Palande To: linux-omap@vger.kernel.org Cc: felipe.contreras@nokia.com, nm@ti.com, deepak.chitriki@ti.com, x0095840@ti.com, omar.ramirez@ti.com Subject: [PATCH 3/4] DSPBRIDGE: Fix memory corruption in DRV_ProcFreeDMMRes Date: Thu, 18 Feb 2010 16:40:52 +0200 Message-Id: <9fb63d8737768758ac367ff242c4142f38ce7427.1266503387.git.ameya.palande@nokia.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <0fd274366a6ad4fda3d20103f52a314bb6ebef57.1266503387.git.ameya.palande@nokia.com> References: <0fd274366a6ad4fda3d20103f52a314bb6ebef57.1266503387.git.ameya.palande@nokia.com> In-Reply-To: References: X-OriginalArrivalTime: 18 Feb 2010 14:41:43.0201 (UTC) FILETIME=[7D05D910:01CAB0A8] X-Nokia-AV: Clean 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, 18 Feb 2010 14:41:55 +0000 (UTC) diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c index 12ba7e0..b88b5a3 100644 --- a/drivers/dsp/bridge/rmgr/drv.c +++ b/drivers/dsp/bridge/rmgr/drv.c @@ -293,12 +293,12 @@ DSP_STATUS DRV_ProcFreeDMMRes(HANDLE hPCtxt) pDMMRes = pDMMList; pDMMList = pDMMList->next; if (pDMMRes->dmmAllocated) { + /* PROC_UnMap will free pDMMRes pointer */ status = PROC_UnMap(pDMMRes->hProcessor, - (void *)pDMMRes->ulDSPResAddr, pCtxt); + (void *)pDMMRes->ulDSPAddr, pCtxt); if (DSP_FAILED(status)) pr_debug("%s: PROC_UnMap failed! status =" " 0x%xn", __func__, status); - pDMMRes->dmmAllocated = 0; } } return status; @@ -309,17 +309,9 @@ DSP_STATUS DRV_RemoveAllDMMResElements(HANDLE hPCtxt) { struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt; DSP_STATUS status = DSP_SOK; - struct DMM_MAP_OBJECT *pTempDMMRes2 = NULL; - struct DMM_MAP_OBJECT *pTempDMMRes = NULL; struct DMM_RSV_OBJECT *temp, *rsv_obj; DRV_ProcFreeDMMRes(pCtxt); - pTempDMMRes = pCtxt->dmm_map_list; - while (pTempDMMRes != NULL) { - pTempDMMRes2 = pTempDMMRes; - pTempDMMRes = pTempDMMRes->next; - kfree(pTempDMMRes2); - } pCtxt->dmm_map_list = NULL; /* Free DMM reserved memory resources */