From patchwork Wed Feb 17 18:05:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ameya Palande X-Patchwork-Id: 79996 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 o1HI6aB5016075 for ; Wed, 17 Feb 2010 18:06:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469Ab0BQSGk (ORCPT ); Wed, 17 Feb 2010 13:06:40 -0500 Received: from smtp.nokia.com ([192.100.122.230]:43172 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753396Ab0BQSGj (ORCPT ); Wed, 17 Feb 2010 13:06:39 -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 o1HI6VNC016963; Wed, 17 Feb 2010 20:06:33 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 17 Feb 2010 20:06:30 +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); Wed, 17 Feb 2010 20:06:30 +0200 Received: from localhost.localdomain (esdhcp041232.research.nokia.com [172.21.41.232]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1HI6HFI023896; Wed, 17 Feb 2010 20:06:24 +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: [PATCHv4 3/4] DSPBRIDGE: Fix memory corruption in DRV_ProcFreeDMMRes Date: Wed, 17 Feb 2010 20:05:40 +0200 Message-Id: <5403b3fb5b4b426d50151571d68f332da03491be.1266429437.git.ameya.palande@nokia.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <7b2296a1856ed89b24b63b978a15acfe675e12ce.1266429437.git.ameya.palande@nokia.com> References: <7b2296a1856ed89b24b63b978a15acfe675e12ce.1266429437.git.ameya.palande@nokia.com> In-Reply-To: References: X-OriginalArrivalTime: 17 Feb 2010 18:06:30.0874 (UTC) FILETIME=[EEA233A0:01CAAFFB] 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]); Wed, 17 Feb 2010 18:06:41 +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 */