memblock: fix handling of NOMAP regions with kmemleak.

NOMAP regions don't have linear map entries so an attempt to scan these
 areas in kmemleak would fault.
 
 Prevent such faults by excluding NOMAP regions from kmemleak.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCAAxFiEEeOVYVaWZL5900a/pOQOGJssO/ZEFAmFqfG8THHJwcHRAbGlu
 dXguaWJtLmNvbQAKCRA5A4Ymyw79kcfoB/9PNSlArkXh5zO/UBFQDH1tkfCVX1ai
 AZwwcSCNz9A1qdDJR/PyihvfhT2eQVyGM01jS4qanBxAbZzyTvFujn5lLryK/TMn
 IFg+HRJEcABf1o+xnlA3CiyeOYAwokh71lhdKH+D/i00foj9vHvReLRNj5Hc941/
 cZ5KwK+ywpR4SaIMLAqjmKsROZF8UpGSAu7Pkd7mI9kckOwJ9fbKkYepset1ehgc
 1u0NpvfgUvgJCU/TEi1c4Ioposm8zTf8zRFLf5mhEL21iRe5PV/YRuyyI0saLlv/
 0dOIqj9InMxtT8vfMvOXi466cr8w2VxAVA9pUN6jkcI33hmkEUQnnGt+
 =BnCQ
 -----END PGP SIGNATURE-----

Merge tag 'fixes-2021-10-16' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock

Pull memblock fix from Mike Rapoport:
 "Fix handling of NOMAP regions with kmemleak.

  NOMAP regions don't have linear map entries so an attempt to scan
  these areas in kmemleak would fault.

  Prevent such faults by excluding NOMAP regions from kmemleak"

* tag 'fixes-2021-10-16' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
  memblock: exclude NOMAP regions from kmemleak
This commit is contained in:
Linus Torvalds 2021-10-16 10:57:13 -07:00
commit ccfb5ceb40

View File

@ -936,7 +936,12 @@ int __init_memblock memblock_mark_mirror(phys_addr_t base, phys_addr_t size)
*/
int __init_memblock memblock_mark_nomap(phys_addr_t base, phys_addr_t size)
{
return memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP);
int ret = memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP);
if (!ret)
kmemleak_free_part_phys(base, size);
return ret;
}
/**