From patchwork Fri Feb 12 16:26:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Carmody X-Patchwork-Id: 78910 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 o1CGQ48E018883 for ; Fri, 12 Feb 2010 16:26:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757155Ab0BLQ0A (ORCPT ); Fri, 12 Feb 2010 11:26:00 -0500 Received: from smtp.nokia.com ([192.100.105.134]:63301 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757157Ab0BLQZ7 (ORCPT ); Fri, 12 Feb 2010 11:25:59 -0500 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1CGPlGi010529; Fri, 12 Feb 2010 10:25:55 -0600 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 12 Feb 2010 18:24:50 +0200 Received: from mgw-sa01.ext.nokia.com ([147.243.1.47]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 12 Feb 2010 18:24:50 +0200 Received: from localhost.localdomain (esdhcp04142.research.nokia.com [172.21.41.42]) by mgw-sa01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1CGOkr9001934; Fri, 12 Feb 2010 18:24:49 +0200 From: Phil Carmody To: omar.ramirez@ti.com Cc: nm@ti.com, linux-omap@vger.kernel.org Subject: [PATCH 2/2] dspbridge: proc: fix a double-free on 2 error paths Date: Fri, 12 Feb 2010 18:26:54 +0200 Message-Id: X-Mailer: git-send-email 1.6.0.4 In-Reply-To: References: <1265992014-7917-1-git-send-email-ext-phil.2.carmody@nokia.com> In-Reply-To: References: X-OriginalArrivalTime: 12 Feb 2010 16:24:50.0453 (UTC) FILETIME=[E66F1450:01CAABFF] 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]); Fri, 12 Feb 2010 16:26:05 +0000 (UTC) diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c index 7bc1bcd..e89077b 100644 --- a/drivers/dsp/bridge/rmgr/proc.c +++ b/drivers/dsp/bridge/rmgr/proc.c @@ -349,13 +349,11 @@ DSP_STATUS PROC_AutoStart(struct CFG_DEVNODE *hDevNode, status = DEV_GetWMDContext(hDevObject, &pProcObject->hWmdContext); if (DSP_FAILED(status)) { - MEM_FreeObject(pProcObject); GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_AutoStart: Failed " "to get WMD Context \n"); } } else { - MEM_FreeObject(pProcObject); GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_AutoStart: Failed to " "get IntFxns \n"); @@ -377,6 +375,10 @@ DSP_STATUS PROC_AutoStart(struct CFG_DEVNODE *hDevNode, "CFG_GetAutoStart DSP_FAILED \n"); goto func_cont; } + + /* paranoid - must be able to kfree this on remaining error paths */ + pProcObject->g_pszLastCoff = NULL; + /* Get the default executable for this board... */ DEV_GetDevType(hDevObject, (u32 *)&devType); pProcObject->uProcessor = devType; @@ -406,9 +408,9 @@ DSP_STATUS PROC_AutoStart(struct CFG_DEVNODE *hDevNode, GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_AutoStart: " "No Exec file found \n"); } -func_cont: kfree(pProcObject->g_pszLastCoff); pProcObject->g_pszLastCoff = NULL; +func_cont: MEM_FreeObject(pProcObject); func_end: GT_1trace(PROC_DebugMask, GT_ENTER,