From 701ad0619ed3c7a7c94b74c6facbaec775640d99 Mon Sep 17 00:00:00 2001 From: Dennis Zhou Date: Sat, 10 Oct 2020 15:40:29 +0800 Subject: [PATCH] percpu: update free path with correct new free region mainline inclusion from mainline-5.2-rc1 commit 8e5a2b9893f36457582596fdade10f6feb2797ee category: bugfix bugzilla: 34611 CVE: NA ------------------------------------------------- When updating the chunk's contig_hint on the free path of a hint that does not touch the page boundaries, it was incorrectly using the starting offset of the free region and the block's contig_hint. This could lead to incorrect assumptions about fit given a size and better alignment of the start. Fix this by using (end - start) as this is only called when updating a hint within a block. Signed-off-by: Dennis Zhou Reviewed-by: Peng Fan (cherry picked from commit 8e5a2b9893f36457582596fdade10f6feb2797ee) Signed-off-by: Kefeng Wang Signed-off-by: Liu Shixin Reviewed-by: Kefeng Wang Signed-off-by: Yang Yingliang --- mm/percpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/percpu.c b/mm/percpu.c index fef316942ea9..092f777422d6 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -871,7 +871,7 @@ static void pcpu_block_update_hint_free(struct pcpu_chunk *chunk, int bit_off, pcpu_chunk_refresh_hint(chunk); else pcpu_chunk_update(chunk, pcpu_block_off_to_off(s_index, start), - s_block->contig_hint); + end - start); } /** -- GitLab