All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] memblock: use kfree() to release kmalloced memblock regions" failed to apply to 5.15-stable tree
@ 2022-02-28  8:58 gregkh
  2022-02-28  9:34 ` Mike Rapoport
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2022-02-28  8:58 UTC (permalink / raw)
  To: linmiaohe, rppt; +Cc: stable


The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From c94afc46cae7ad41b2ad6a99368147879f4b0e56 Mon Sep 17 00:00:00 2001
From: Miaohe Lin <linmiaohe@huawei.com>
Date: Thu, 17 Feb 2022 22:53:27 +0800
Subject: [PATCH] memblock: use kfree() to release kmalloced memblock regions

memblock.{reserved,memory}.regions may be allocated using kmalloc() in
memblock_double_array(). Use kfree() to release these kmalloced regions
indicated by memblock_{reserved,memory}_in_slab.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Fixes: 3010f876500f ("mm: discard memblock data later")
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>

diff --git a/mm/memblock.c b/mm/memblock.c
index 1018e50566f3..b12a364f2766 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -366,14 +366,20 @@ void __init memblock_discard(void)
 		addr = __pa(memblock.reserved.regions);
 		size = PAGE_ALIGN(sizeof(struct memblock_region) *
 				  memblock.reserved.max);
-		memblock_free_late(addr, size);
+		if (memblock_reserved_in_slab)
+			kfree(memblock.reserved.regions);
+		else
+			memblock_free_late(addr, size);
 	}
 
 	if (memblock.memory.regions != memblock_memory_init_regions) {
 		addr = __pa(memblock.memory.regions);
 		size = PAGE_ALIGN(sizeof(struct memblock_region) *
 				  memblock.memory.max);
-		memblock_free_late(addr, size);
+		if (memblock_memory_in_slab)
+			kfree(memblock.memory.regions);
+		else
+			memblock_free_late(addr, size);
 	}
 
 	memblock_memory = NULL;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] memblock: use kfree() to release kmalloced memblock regions" failed to apply to 5.15-stable tree
  2022-02-28  8:58 FAILED: patch "[PATCH] memblock: use kfree() to release kmalloced memblock regions" failed to apply to 5.15-stable tree gregkh
@ 2022-02-28  9:34 ` Mike Rapoport
  2022-02-28 10:55   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Rapoport @ 2022-02-28  9:34 UTC (permalink / raw)
  To: gregkh; +Cc: linmiaohe, stable

On Mon, Feb 28, 2022 at 09:58:43AM +0100, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 5.15-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.

This version applies to 5.15 and should apply to older version as well.

From d4895990ebea634715d2dcf54121c5ae5a6612bc Mon Sep 17 00:00:00 2001
From: Miaohe Lin <linmiaohe@huawei.com>
Date: Thu, 17 Feb 2022 22:53:27 +0800
Subject: [PATCH] memblock: use kfree() to release kmalloced memblock regions

memblock.{reserved,memory}.regions may be allocated using kmalloc() in
memblock_double_array(). Use kfree() to release these kmalloced regions
indicated by memblock_{reserved,memory}_in_slab.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Fixes: 3010f876500f ("mm: discard memblock data later")
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 mm/memblock.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 5096500b2647..2b7397781c99 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -366,14 +366,20 @@ void __init memblock_discard(void)
 		addr = __pa(memblock.reserved.regions);
 		size = PAGE_ALIGN(sizeof(struct memblock_region) *
 				  memblock.reserved.max);
-		__memblock_free_late(addr, size);
+		if (memblock_reserved_in_slab)
+			kfree(memblock.reserved.regions);
+		else
+			__memblock_free_late(addr, size);
 	}
 
 	if (memblock.memory.regions != memblock_memory_init_regions) {
 		addr = __pa(memblock.memory.regions);
 		size = PAGE_ALIGN(sizeof(struct memblock_region) *
 				  memblock.memory.max);
-		__memblock_free_late(addr, size);
+		if (memblock_memory_in_slab)
+			kfree(memblock.memory.regions);
+		else
+			__memblock_free_late(addr, size);
 	}
 
 	memblock_memory = NULL;
-- 
2.28.0

> thanks,
> 
> greg k-h

--
Sincerely yours,
Mike.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] memblock: use kfree() to release kmalloced memblock regions" failed to apply to 5.15-stable tree
  2022-02-28  9:34 ` Mike Rapoport
@ 2022-02-28 10:55   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-02-28 10:55 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: linmiaohe, stable

On Mon, Feb 28, 2022 at 11:34:16AM +0200, Mike Rapoport wrote:
> On Mon, Feb 28, 2022 at 09:58:43AM +0100, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 5.15-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> 
> This version applies to 5.15 and should apply to older version as well.
> 
> >From d4895990ebea634715d2dcf54121c5ae5a6612bc Mon Sep 17 00:00:00 2001
> From: Miaohe Lin <linmiaohe@huawei.com>
> Date: Thu, 17 Feb 2022 22:53:27 +0800
> Subject: [PATCH] memblock: use kfree() to release kmalloced memblock regions
> 
> memblock.{reserved,memory}.regions may be allocated using kmalloc() in
> memblock_double_array(). Use kfree() to release these kmalloced regions
> indicated by memblock_{reserved,memory}_in_slab.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> Fixes: 3010f876500f ("mm: discard memblock data later")
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
>  mm/memblock.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-28 10:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28  8:58 FAILED: patch "[PATCH] memblock: use kfree() to release kmalloced memblock regions" failed to apply to 5.15-stable tree gregkh
2022-02-28  9:34 ` Mike Rapoport
2022-02-28 10:55   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.