From patchwork Fri Jan 13 12:36:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mans Rullgard X-Patchwork-Id: 6180 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 BDB8823E16 for ; Fri, 13 Jan 2012 12:37:02 +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 A651DA182CC for ; Fri, 13 Jan 2012 12:37:02 +0000 (UTC) Received: by bkbzu5 with SMTP id zu5so2781547bkb.11 for ; Fri, 13 Jan 2012 04:37:02 -0800 (PST) Received: by 10.204.38.80 with SMTP id a16mr260351bke.99.1326458222138; Fri, 13 Jan 2012 04:37:02 -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 ac16cs28235bkc; Fri, 13 Jan 2012 04:37:01 -0800 (PST) Received: by 10.180.76.235 with SMTP id n11mr8525615wiw.11.1326458220434; Fri, 13 Jan 2012 04:37:00 -0800 (PST) Received: from unicorn.mansr.com (unicorn.mansr.com. [78.86.181.103]) by mx.google.com with ESMTP id n8si4911941weq.24.2012.01.13.04.37.00; Fri, 13 Jan 2012 04:37:00 -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 8CFF415AEC; Fri, 13 Jan 2012 12:36:59 +0000 (GMT) From: Mans Rullgard To: linux-arm-kernel@lists.infradead.org Cc: linaro-dev@lists.linaro.org, patches@linaro.org, Russell King , Jassi Brar , Javi Merino , Lucas De Marchi , linux-kernel@vger.kernel.org Subject: [PATCH] ARM: pl330: fix null pointer dereference in pl330_chan_ctrl() Date: Fri, 13 Jan 2012 12:36:31 +0000 Message-Id: <1326458191-23492-1-git-send-email-mans.rullgard@linaro.org> X-Mailer: git-send-email 1.7.8.3 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 Acked-by: Javi Merino --- arch/arm/common/pl330.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c index 8d8df74..67abef5 100644 --- a/arch/arm/common/pl330.c +++ b/arch/arm/common/pl330.c @@ -1496,12 +1496,13 @@ 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);