linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/1] Reversed logic in memblock_discard
@ 2017-08-23 18:04 Pavel Tatashin
  2017-08-23 18:04 ` [PATCH v1 1/1] mm: " Pavel Tatashin
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Tatashin @ 2017-08-23 18:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, mhocko, akpm, terraluna977

One line fix for reversed logic where static array is freed instead of
allocated one

Pavel Tatashin (1):
  mm: Reversed logic in memblock_discard

 mm/memblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.14.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH v1 1/1] mm: Reversed logic in memblock_discard
  2017-08-23 18:04 [PATCH v1 0/1] Reversed logic in memblock_discard Pavel Tatashin
@ 2017-08-23 18:04 ` Pavel Tatashin
  2017-08-24 12:21   ` Vlastimil Babka
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Tatashin @ 2017-08-23 18:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, mhocko, akpm, terraluna977

In recently introduced memblock_discard() there is a reversed logic bug.
Memory is freed of static array instead of dynamically allocated one.

Fixes: 3010f876500f ("mm: discard memblock data later")

Reported-and-tested-by: Woody Suwalski <terraluna977@gmail.com>
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
---
 mm/memblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index bf14aea6ab70..91205780e6b1 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -299,7 +299,7 @@ void __init memblock_discard(void)
 		__memblock_free_late(addr, size);
 	}
 
-	if (memblock.memory.regions == memblock_memory_init_regions) {
+	if (memblock.memory.regions != memblock_memory_init_regions) {
 		addr = __pa(memblock.memory.regions);
 		size = PAGE_ALIGN(sizeof(struct memblock_region) *
 				  memblock.memory.max);
-- 
2.14.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH v1 1/1] mm: Reversed logic in memblock_discard
  2017-08-23 18:04 ` [PATCH v1 1/1] mm: " Pavel Tatashin
@ 2017-08-24 12:21   ` Vlastimil Babka
  0 siblings, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2017-08-24 12:21 UTC (permalink / raw)
  To: Pavel Tatashin, linux-kernel, linux-mm, mhocko, akpm,
	terraluna977, stable

+CC stable

On 08/23/2017 08:04 PM, Pavel Tatashin wrote:
> In recently introduced memblock_discard() there is a reversed logic bug.
> Memory is freed of static array instead of dynamically allocated one.
> 
> Fixes: 3010f876500f ("mm: discard memblock data later")

That patch was CC'd stable. So this one should be too. Looks like it the
original patch wasn't yet included in a stable release, so we can avoid
breakage.

> Reported-and-tested-by: Woody Suwalski <terraluna977@gmail.com>
> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
> ---
>  mm/memblock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index bf14aea6ab70..91205780e6b1 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -299,7 +299,7 @@ void __init memblock_discard(void)
>  		__memblock_free_late(addr, size);
>  	}
>  
> -	if (memblock.memory.regions == memblock_memory_init_regions) {
> +	if (memblock.memory.regions != memblock_memory_init_regions) {
>  		addr = __pa(memblock.memory.regions);
>  		size = PAGE_ALIGN(sizeof(struct memblock_region) *
>  				  memblock.memory.max);
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2017-08-24 12:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 18:04 [PATCH v1 0/1] Reversed logic in memblock_discard Pavel Tatashin
2017-08-23 18:04 ` [PATCH v1 1/1] mm: " Pavel Tatashin
2017-08-24 12:21   ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).