From patchwork Tue Sep 1 08:11:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 45001 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n818CHVv012594 for ; Tue, 1 Sep 2009 08:12:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753212AbZIAILg (ORCPT ); Tue, 1 Sep 2009 04:11:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753208AbZIAILg (ORCPT ); Tue, 1 Sep 2009 04:11:36 -0400 Received: from smtp.nokia.com ([192.100.122.230]:26157 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753191AbZIAILf (ORCPT ); Tue, 1 Sep 2009 04:11:35 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n818BJtO010729 for ; Tue, 1 Sep 2009 11:11:28 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 1 Sep 2009 11:11:31 +0300 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 1 Sep 2009 11:11:30 +0300 Received: from dilbert.research.nokia.com (esdhcp034223.research.nokia.com [172.21.34.223]) by mgw-da01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n818BNCu016352 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Tue, 1 Sep 2009 11:11:25 +0300 Received: from andy by dilbert.research.nokia.com with local (Exim 4.69) (envelope-from ) id 1MiOSX-0003lp-Mq; Tue, 01 Sep 2009 11:11:21 +0300 From: andy.shevchenko@gmail.com To: linux-omap@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH] dspbridge: Check pointer before usage Date: Tue, 1 Sep 2009 11:11:21 +0300 Message-Id: <1251792681-14472-1-git-send-email-andy.shevchenko@gmail.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1251791985-14412-1-git-send-email-andy.shevchenko@gmail.com> References: <1251791985-14412-1-git-send-email-andy.shevchenko@gmail.com> X-OriginalArrivalTime: 01 Sep 2009 08:11:31.0253 (UTC) FILETIME=[D0309650:01CA2ADB] Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Andy Shevchenko Check list pointer at every itteration because it could be deleted before we go into the for loop. Reworked version of the previous attempts. Signed-off-by: Andy Shevchenko --- drivers/dsp/bridge/rmgr/drv.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c index d21071c..7e41669 100644 --- a/drivers/dsp/bridge/rmgr/drv.c +++ b/drivers/dsp/bridge/rmgr/drv.c @@ -1543,8 +1543,9 @@ DSP_STATUS DRV_ReleaseResources(u32 dwContext, struct DRV_OBJECT *hDrvObject) * The following will over write the status. */ for (pszdevNode = (struct DRV_EXT *)DRV_GetFirstDevExtension(); - pszdevNode != NULL; pszdevNode = (struct DRV_EXT *) - DRV_GetNextDevExtension((u32)pszdevNode)) { + pszdevNode != NULL && pDRVObject->devNodeString != NULL; + pszdevNode = (struct DRV_EXT *) + DRV_GetNextDevExtension((u32) pszdevNode)) { if ((u32)pszdevNode == dwContext) { /* Found it */ /* Delete from the Driver object list */