From patchwork Fri Jan 13 19:46:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mans Rullgard X-Patchwork-Id: 6200 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5EFC923E0E for ; Fri, 13 Jan 2012 19:47:32 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 4861CA18087 for ; Fri, 13 Jan 2012 19:47:32 +0000 (UTC) Received: by bkbzu5 with SMTP id zu5so3216518bkb.11 for ; Fri, 13 Jan 2012 11:47:32 -0800 (PST) Received: by 10.205.26.67 with SMTP id rl3mr1037089bkb.45.1326484051969; Fri, 13 Jan 2012 11:47:31 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs37911bkc; Fri, 13 Jan 2012 11:47:31 -0800 (PST) Received: by 10.180.82.41 with SMTP id f9mr4505795wiy.7.1326484050017; Fri, 13 Jan 2012 11:47:30 -0800 (PST) Received: from unicorn.mansr.com (unicorn.mansr.com. [78.86.181.103]) by mx.google.com with ESMTP id t50si5713578wec.134.2012.01.13.11.47.29; Fri, 13 Jan 2012 11:47:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of mru@mansr.com designates 78.86.181.103 as permitted sender) client-ip=78.86.181.103; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of mru@mansr.com designates 78.86.181.103 as permitted sender) smtp.mail=mru@mansr.com Received: by unicorn.mansr.com (Postfix, from userid 51770) id 1952B15AEC; Fri, 13 Jan 2012 19:47:29 +0000 (GMT) From: Mans Rullgard To: Javi Merino Cc: linux-arm-kernel@lists.infradead.org, linaro-dev@lists.linaro.org, patches@linaro.org, Russell King , Jassi Brar , linux-kernel@vger.kernel.org, Boojin Kim , Kukjin Kim Subject: [PATCH] ARM: pl330: fix null pointer dereference in pl330_chan_ctrl() Date: Fri, 13 Jan 2012 19:46:22 +0000 Message-Id: <1326483982-13610-1-git-send-email-mans.rullgard@linaro.org> X-Mailer: git-send-email 1.7.8.3 In-Reply-To: <4F103620.8070504@arm.com> References: <4F103620.8070504@arm.com> This fixes the thrd->req_running field being accessed before thrd is checked for null. The error was introduced in abb959f. Signed-off-by: Mans Rullgard --- drivers/dma/pl330.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 3a6e042..cb3e597 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -1568,12 +1568,13 @@ static int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op) struct pl330_thread *thrd = ch_id; struct pl330_dmac *pl330; unsigned long flags; - int ret = 0, active = thrd->req_running; + int ret = 0, active; if (!thrd || thrd->free || thrd->dmac->state == DYING) return -EINVAL; pl330 = thrd->dmac; + active = thrd->req_running; spin_lock_irqsave(&pl330->lock, flags);