]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/intel_th-gth-fix-an-off-by-one-in-output-unassigning.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / intel_th-gth-fix-an-off-by-one-in-output-unassigning.patch
1 From 91d3f8a629849968dc91d6ce54f2d46abf4feb7f Mon Sep 17 00:00:00 2001
2 From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
3 Date: Fri, 1 Mar 2019 10:09:55 +0200
4 Subject: intel_th: gth: Fix an off-by-one in output unassigning
5
6 From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
7
8 commit 91d3f8a629849968dc91d6ce54f2d46abf4feb7f upstream.
9
10 Commit 9ed3f22223c3 ("intel_th: Don't reference unassigned outputs")
11 fixes a NULL dereference for all masters except the last one ("256+"),
12 which keeps the stale pointer after the output driver had been unassigned.
13
14 Fix the off-by-one.
15
16 Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
17 Fixes: 9ed3f22223c3 ("intel_th: Don't reference unassigned outputs")
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 drivers/hwtracing/intel_th/gth.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24 --- a/drivers/hwtracing/intel_th/gth.c
25 +++ b/drivers/hwtracing/intel_th/gth.c
26 @@ -597,7 +597,7 @@ static void intel_th_gth_unassign(struct
27 othdev->output.port = -1;
28 othdev->output.active = false;
29 gth->output[port].output = NULL;
30 - for (master = 0; master < TH_CONFIGURABLE_MASTERS; master++)
31 + for (master = 0; master <= TH_CONFIGURABLE_MASTERS; master++)
32 if (gth->master[master] == port)
33 gth->master[master] = -1;
34 spin_unlock(&gth->gth_lock);