[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190221134959.15121-7-alexander.shishkin@linux.intel.com>
Date: Thu, 21 Feb 2019 15:49:58 +0200
From: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Mathieu Poirier <mathieu.poirier@...aro.org>,
linux-kernel@...r.kernel.org, Zhi Jin <zhi.jin@...el.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Subject: [GIT PULL 6/7] stm class: Fix an endless loop in channel allocation
From: Zhi Jin <zhi.jin@...el.com>
There is a bug in the channel allocation logic that leads to an endless
loop when looking for a contiguous range of channels in a range with a
mixture of free and occupied channels. For example, opening three
consequtive channels, closing the first two and requesting 4 channels in
a row will trigger this soft lockup. The bug is that the search loop
forgets to skip over the range once it detects that one channel in that
range is occupied.
Restore the original intent to the logic by fixing the omission.
Fixes: 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")
Signed-off-by: Zhi Jin <zhi.jin@...el.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
---
drivers/hwtracing/stm/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index 93ce3aa740a9..c80b064224f6 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -244,6 +244,9 @@ static int find_free_channels(unsigned long *bitmap, unsigned int start,
;
if (i == width)
return pos;
+
+ /* step over [pos..pos+i) to continue search */
+ pos += i;
}
return -1;
--
2.20.1
Powered by blists - more mailing lists