[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.9 / 0012-ARM-7326-2-PL330-fix-null-pointer-dereference-in-pl3.patch
1 From 4dba080e4a963820e5b9a810bdbec72c2e33a5cb Mon Sep 17 00:00:00 2001
2 From: Javi Merino <javi.merino@arm.com>
3 Date: Wed, 15 Feb 2012 17:36:39 +0100
4 Subject: [PATCH 12/72] ARM: 7326/2: PL330: fix null pointer dereference in
5 pl330_chan_ctrl()
7 commit 46e33c606af8e0caeeca374103189663d877c0d6 upstream.
9 This fixes the thrd->req_running field being accessed before thrd
10 is checked for null. The error was introduced in
12 abb959f: ARM: 7237/1: PL330: Fix driver freeze
14 Reference: <1326458191-23492-1-git-send-email-mans.rullgard@linaro.org>
16 Signed-off-by: Mans Rullgard <mans.rullgard@linaro.org>
17 Acked-by: Javi Merino <javi.merino@arm.com>
18 Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 ---
21 arch/arm/common/pl330.c | 3 ++-
22 1 file changed, 2 insertions(+), 1 deletion(-)
24 diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c
25 index 8d8df74..67abef5 100644
26 --- a/arch/arm/common/pl330.c
27 +++ b/arch/arm/common/pl330.c
28 @@ -1496,12 +1496,13 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
29 struct pl330_thread *thrd = ch_id;
30 struct pl330_dmac *pl330;
31 unsigned long flags;
32 - int ret = 0, active = thrd->req_running;
33 + int ret = 0, active;
35 if (!thrd || thrd->free || thrd->dmac->state == DYING)
36 return -EINVAL;
38 pl330 = thrd->dmac;
39 + active = thrd->req_running;
41 spin_lock_irqsave(&pl330->lock, flags);
43 --
44 1.7.9.4