From patchwork Tue Mar 5 15:58:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 2220311 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork2.kernel.org (Postfix) with ESMTP id 3B673DF24C for ; Tue, 5 Mar 2013 16:04:02 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r25Fxgtv007936; Tue, 5 Mar 2013 09:59:42 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r25FxgHg005830; Tue, 5 Mar 2013 09:59:42 -0600 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Tue, 5 Mar 2013 09:59:42 -0600 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id r25FxfxT002169; Tue, 5 Mar 2013 09:59:41 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id DF1E380627; Tue, 5 Mar 2013 09:59:41 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 5060A80626 for ; Tue, 5 Mar 2013 09:59:40 -0600 (CST) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r25Fxeeb015329 for ; Tue, 5 Mar 2013 09:59:40 -0600 (CST) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id r25FxdxF024004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 5 Mar 2013 09:59:39 -0600 Received: from [216.82.253.147:9635] by server-10.bemta-7.messagelabs.com id B2/E7-25850-B6616315; Tue, 05 Mar 2013 15:59:39 +0000 X-Env-Sender: ohiomdp@gmail.com X-Msg-Ref: server-10.tower-165.messagelabs.com!1362499092!10446671!1 X-Originating-IP: [209.85.223.177] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.8.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16472 invoked from network); 5 Mar 2013 15:58:12 -0000 Received: from mail-ie0-f177.google.com (HELO mail-ie0-f177.google.com) (209.85.223.177) by server-10.tower-165.messagelabs.com with RC4-SHA encrypted SMTP; 5 Mar 2013 15:58:12 -0000 Received: by mail-ie0-f177.google.com with SMTP id 16so8025752iea.36 for ; Tue, 05 Mar 2013 07:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=z6IUa3eHQhGQL3A6C3p054bWpS+RfyIwMWRiQDSBuvw=; b=0z+ZyrWX5ZDq4RdsmcpIosPmQYx0nxg5LH+iIQBmDho6G6BHt6IDezHjV2Kgr8qyIl ez0zu/RUjmxfLInEwOKi5AOXDqySXdaVBNPvFkl3qJQhy3m0zRkQxNba34Z8wnjDpdLe +XUeqYFjGxL1n9pzi3p3wMekTfk6bU5JxWnkPYZci8vVoAl2FPVosrKNfdy57OS5bXu4 T+IZuhFJWvySz8XcEUGWWqvbVnn7IJjbrRY6eG4AwswkAAnt/Ml4xHDs/fceIBMqDEo1 KMb6Pg32uZh1KpNWzv2jxyTbalxowdPvswEMkXgIiLTjNcn/ghTxRuUqQaCPl4bs0fm+ ECrA== X-Received: by 10.50.237.71 with SMTP id va7mr6681420igc.88.1362499091733; Tue, 05 Mar 2013 07:58:11 -0800 (PST) Received: from beef.ohporter.com (cpe-98-27-254-98.neo.res.rr.com. [98.27.254.98]) by mx.google.com with ESMTPS id uq1sm16210770igc.5.2013.03.05.07.58.10 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Mar 2013 07:58:11 -0800 (PST) From: Matt Porter To: Sekhar Nori Subject: [PATCH v2] arm: davinci: fix edma dmaengine induced null pointer dereference on da830 Date: Tue, 5 Mar 2013 10:58:22 -0500 Message-ID: <1362499102-16468-1-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 CC: Linux DaVinci Kernel List , Linux ARM Kernel List X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com This adds additional error checking to the private edma api implementation to catch the case where the edma_alloc_slot() has an invalid controller parameter. The edma dmaengine wrapper driver relies on this condition being handled in order to avoid setting up a second edma dmaengine instance on DA830. Verfied using a DA850 with the second EDMA controller platform instance removed to simulate a DA830 which only has a single EDMA controller. Reported-by: Tomas Novotny Signed-off-by: Matt Porter Cc: stable@vger.kernel.org # v3.7.x+ Tested-by: Tomas Novotny --- v2: Move error check out of conditional to catch all cases arch/arm/mach-davinci/dma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c index a685e97..45b7c71 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/mach-davinci/dma.c @@ -743,6 +743,9 @@ EXPORT_SYMBOL(edma_free_channel); */ int edma_alloc_slot(unsigned ctlr, int slot) { + if (!edma_cc[ctlr]) + return -EINVAL; + if (slot >= 0) slot = EDMA_CHAN_SLOT(slot);