From patchwork Mon Mar 4 16:52:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 2213461 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork1.kernel.org (Postfix) with ESMTP id 3DA9940077 for ; Mon, 4 Mar 2013 16:56:56 +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 r24Gqj7G014253; Mon, 4 Mar 2013 10:52:45 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r24Gqjt0009460; Mon, 4 Mar 2013 10:52:45 -0600 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Mon, 4 Mar 2013 10:52:44 -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 r24Gqihc015495; Mon, 4 Mar 2013 10:52:44 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id B677480627; Mon, 4 Mar 2013 10:52:44 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id F3BF680626 for ; Mon, 4 Mar 2013 10:52:42 -0600 (CST) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id r24GqgSd004845 for ; Mon, 4 Mar 2013 10:52:42 -0600 (CST) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id r24GqgJq026675 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 4 Mar 2013 10:52:42 -0600 Received: from [216.82.253.147:33142] by server-11.bemta-7.messagelabs.com id C9/3C-26577-A51D4315; Mon, 04 Mar 2013 16:52:42 +0000 X-Env-Sender: ohiomdp@gmail.com X-Msg-Ref: server-9.tower-165.messagelabs.com!1362415957!9068749!1 X-Originating-IP: [209.85.210.176] 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 1176 invoked from network); 4 Mar 2013 16:52:38 -0000 Received: from mail-ia0-f176.google.com (HELO mail-ia0-f176.google.com) (209.85.210.176) by server-9.tower-165.messagelabs.com with RC4-SHA encrypted SMTP; 4 Mar 2013 16:52:38 -0000 Received: by mail-ia0-f176.google.com with SMTP id i18so4966961iac.35 for ; Mon, 04 Mar 2013 08:52:37 -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=oZDgktppLXCfcc0LAc/s27IAtzenU6ka0GV0WqOVQqI=; b=CAI1UYycDaVGDrVQ3PsZwtJ7LbLvIp4nKK58wKmyC57ik340sMrqotm37KyWdJFq46 8mbM4LTa/nvq0O93QVwYEFa7aBBHQMLjrL0HFief3+5rADb4Bs++i+DwA3U41aZRqC9A 0CegJT0eLVC9HVUFzoV/CboVXTbVlZreipkhXThIDB+VfPTKl0PSJz/SAJRA2nLQ0yI+ sr+M1c5oPnbsllLP3GiPdLbYSI/1chtJ8ywaef1h2bi6hrTWXICrJeV01RLFYH7A3fze S5Pd8YCXienRMECYh3uPRa7hFwgLsBhn4vqdsXKUNshJd/0eZnqRvl4tRpjZuGcHN0AS VZOQ== X-Received: by 10.50.155.134 with SMTP id vw6mr3028972igb.34.1362415957735; Mon, 04 Mar 2013 08:52:37 -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 uq1sm10055438igc.5.2013.03.04.08.52.36 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Mar 2013 08:52:37 -0800 (PST) From: Matt Porter To: Sekhar Nori Subject: [PATCH] arm: davinci: fix edma dmaengine induced null pointer dereference on da830 Date: Mon, 4 Mar 2013 11:52:57 -0500 Message-ID: <1362415977-12829-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@kernel.org --- arch/arm/mach-davinci/dma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c index a685e97..f9eb836 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/mach-davinci/dma.c @@ -747,6 +747,8 @@ int edma_alloc_slot(unsigned ctlr, int slot) slot = EDMA_CHAN_SLOT(slot); if (slot < 0) { + if (!edma_cc[ctlr]) + return -EINVAL; slot = edma_cc[ctlr]->num_channels; for (;;) { slot = find_next_zero_bit(edma_cc[ctlr]->edma_inuse,