fix PMD accounting change

-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCAA4FiEEbt46xwy6kEcDOXoUeZbBVTGwZHAFAmENOXwaHHRzYm9nZW5k
 QGFscGhhLmZyYW5rZW4uZGUACgkQeZbBVTGwZHBLVg/+JnFGpTCt56KyF4oUxjRe
 tRcSHdLH4WLGUczbbbuPZe4CD/vpHjIjVmhK/gzZ/WhuTdRIUu2Tko6clx1DdKof
 Qnr9kTTAKxfHwF8Wbu3tkXUsOotIcugwV4aARGtdzMQof7bCUNeRBVcBL3U+xucf
 HqyEbTJDqPtU3O+VX5Os9KWIi7jTDwF+8ysOm7IO6eOpTitMxqLurg5Okfx0qFWw
 5ac7Agat4UtRIg42WvD/N1dRByvDgSSE5I2OGVNpjGPgtYTpjvwimWj0OZBeCe1m
 KCqEyNODkqduhU4ZdV4HoDGwBQhMWdCy1kNraNCxAD14oMD6i0BP/M3+MVc56nEv
 8GVFHwbKSF1Y6rkoVMTVe+7BnksCBy5XgK48tCGHirOsOzcMD1j0E2CbskR7kBwO
 ErwUXYHc5+M8FYZBK2mlxswNmOdSbqRH2ZsOe4BqtTUIyqzI9kL5xwjJxRHjK6Fi
 naCa2kYawCIWQ1iTMJPB4mUy9PUZKqt3dZ8pcRuuhpvc4UFdNcwuVqasLuW50kmo
 qcIe9qm2KYaqaEnUXQlgJ3yxoRyXkPP11zcCFJ9SXSBtwak8oGvarU0xamThr26t
 CQQOtlbMOjIYx3qJ34tGdXX9HLgv0gUeMMDxh9U/9qnwdiwihNUEU3Kl1vrzgnZd
 aoJRV5SClu5ExmnCBgpnZns=
 =iEif
 -----END PGP SIGNATURE-----

Merge tag 'mips-fixes_5.14_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux

Pull MIPS fix from Thomas Bogendoerfer:
 "Fix PMD accounting change"

* tag 'mips-fixes_5.14_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
  MIPS: check return value of pgtable_pmd_page_ctor
This commit is contained in:
Linus Torvalds 2021-08-06 11:31:11 -07:00
commit cb407fc81d
1 changed files with 11 additions and 6 deletions

View File

@ -58,15 +58,20 @@ do { \
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
{
pmd_t *pmd = NULL;
pmd_t *pmd;
struct page *pg;
pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER);
if (pg) {
pgtable_pmd_page_ctor(pg);
pmd = (pmd_t *)page_address(pg);
pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
pg = alloc_pages(GFP_KERNEL_ACCOUNT, PMD_ORDER);
if (!pg)
return NULL;
if (!pgtable_pmd_page_ctor(pg)) {
__free_pages(pg, PMD_ORDER);
return NULL;
}
pmd = (pmd_t *)page_address(pg);
pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
return pmd;
}