]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.51/mm-cma_debug.c-fix-the-break-condition-in-cma_maxchu.patch
Linux 4.19.51
[thirdparty/kernel/stable-queue.git] / releases / 4.19.51 / mm-cma_debug.c-fix-the-break-condition-in-cma_maxchu.patch
CommitLineData
37554d48
SL
1From 6f8b1f3fc9c7097cf634336450e91f1a21a5444c Mon Sep 17 00:00:00 2001
2From: Yue Hu <huyue2@yulong.com>
3Date: Mon, 13 May 2019 17:16:37 -0700
4Subject: mm/cma_debug.c: fix the break condition in cma_maxchunk_get()
5
6[ Upstream commit f0fd50504a54f5548eb666dc16ddf8394e44e4b7 ]
7
8If not find zero bit in find_next_zero_bit(), it will return the size
9parameter passed in, so the start bit should be compared with bitmap_maxno
10rather than cma->count. Although getting maxchunk is working fine due to
11zero value of order_per_bit currently, the operation will be stuck if
12order_per_bit is set as non-zero.
13
14Link: http://lkml.kernel.org/r/20190319092734.276-1-zbestahu@gmail.com
15Signed-off-by: Yue Hu <huyue2@yulong.com>
16Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
17Cc: Michal Hocko <mhocko@suse.com>
18Cc: Joe Perches <joe@perches.com>
19Cc: David Rientjes <rientjes@google.com>
20Cc: Dmitry Safonov <d.safonov@partner.samsung.com>
21Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
22Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
23Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24Signed-off-by: Sasha Levin <sashal@kernel.org>
25---
26 mm/cma_debug.c | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-)
28
29diff --git a/mm/cma_debug.c b/mm/cma_debug.c
30index ad6723e9d110..3e0415076cc9 100644
31--- a/mm/cma_debug.c
32+++ b/mm/cma_debug.c
33@@ -58,7 +58,7 @@ static int cma_maxchunk_get(void *data, u64 *val)
34 mutex_lock(&cma->lock);
35 for (;;) {
36 start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end);
37- if (start >= cma->count)
38+ if (start >= bitmap_maxno)
39 break;
40 end = find_next_bit(cma->bitmap, bitmap_maxno, start);
41 maxchunk = max(end - start, maxchunk);
42--
432.20.1
44