[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231202111430.18059-6-fancer.lancer@gmail.com>
Date: Sat, 2 Dec 2023 14:14:22 +0300
From: Serge Semin <fancer.lancer@...il.com>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Serge Semin <fancer.lancer@...il.com>,
Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
Arnd Bergmann <arnd@...db.de>,
Aleksandar Rikalo <aleksandar.rikalo@...mia.com>,
Aleksandar Rikalo <arikalo@...il.com>,
Dragan Mladjenovic <dragan.mladjenovic@...mia.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Baoquan He <bhe@...hat.com>, Chao-ying Fu <cfu@...ecomp.com>,
Yinglu Yang <yangyinglu@...ngson.cn>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
Mike Rapoport <rppt@...nel.org>,
Matthew Wilcox <willy@...radead.org>,
Marc Zyngier <maz@...nel.org>, linux-mips@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2 5/6] mips: mm: add slab availability checking in ioremap_prot
Recent commit a5f616483110 ("mm/ioremap: add slab availability checking in
ioremap_prot") added the slab availability check to the generic
ioremap_prot() implementation. It is reasonable to be done for the
MIPS32-specific method too since it also relies on the
get_vm_area_caller() function (by means of get_vm_area()) which requires
the slab allocator being up and running before being called.
Signed-off-by: Serge Semin <fancer.lancer@...il.com>
---
arch/mips/mm/ioremap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
index b6dad2fd5575..d8243d61ef32 100644
--- a/arch/mips/mm/ioremap.c
+++ b/arch/mips/mm/ioremap.c
@@ -72,6 +72,10 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, unsigned long size,
flags == _CACHE_UNCACHED)
return (void __iomem *) CKSEG1ADDR(phys_addr);
+ /* Early remaps should use the unmapped regions til' VM is available */
+ if (WARN_ON_ONCE(!slab_is_available()))
+ return NULL;
+
/*
* Don't allow anybody to remap RAM that may be allocated by the page
* allocator, since that could lead to races & data clobbering.
--
2.42.1
Powered by blists - more mailing lists