kasan: fix memory hotplug during boot

commit 3f19597215 upstream.

Using module_init() is wrong.  E.g.  ACPI adds and onlines memory before
our memory notifier gets registered.

This makes sure that ACPI memory detected during boot up will not result
in a kernel crash.

Easily reproducible with QEMU, just specify a DIMM when starting up.

Link: http://lkml.kernel.org/r/20180522100756.18478-3-david@redhat.com
Fixes: 786a895991 ("kasan: disable memory hotplug")
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
David Hildenbrand 2018-05-25 14:48:11 -07:00 коммит произвёл Greg Kroah-Hartman
Родитель b052960484
Коммит 1da530fe15
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -843,5 +843,5 @@ static int __init kasan_memhotplug_init(void)
return 0;
}
module_init(kasan_memhotplug_init);
core_initcall(kasan_memhotplug_init);
#endif