Message ID | 20230706154520.11257-7-bhe@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2656364vqx; Thu, 6 Jul 2023 08:50:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlEgEJWY0YUD4mP8PnFY24x+SxvjlmOqfv7uN8iOUBCTR5U/ncYGEVGsSipyCKFZc/uY19yU X-Received: by 2002:a05:6a00:3a14:b0:668:8705:57cf with SMTP id fj20-20020a056a003a1400b00668870557cfmr2497495pfb.25.1688658617380; Thu, 06 Jul 2023 08:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688658617; cv=none; d=google.com; s=arc-20160816; b=Xs5RJ7XwmoYBrFQairtq9OT9B44clMyZjuyZ4TW69oQQxCF8MaFIVJy7HHVbSsZ6FD 40L0Igqk1Z6ABamAkmvbypfTOTJmuH7N3mPrvEECORooLM98fDBGnGGzYyKdfF2wzbUZ mqJfWtqRUKBRz757Gz4AvLBZXxx9KyBmhd1pHHef6XaRuE7jPZZkYuqZynPzhnH+qcCb g3lGzoWbGzjCFHU1GxPyakXuq6VqDmSiyObpbFsnm0yAb2288ar/RImLWkW51NulPIlZ pBltYZPElVHjEZc6T6oXf5KsftXAzSfZ2Vv3lwSx4zLBz8yWhZdaGGinVe6YN0ve+k2x KjGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=w2IfnXMZqwx1Jn18is50whUi5yxeZ3Kn4EXboxrstks=; fh=MRqAqm0/X6LLHlLdJym4NBXwcTEGRfSmsWs7mgX78Dg=; b=EvmaBuryXaD1ADnDKr9EmT7gXLEUfzWirF11lm4YrOJegtUIWag6paAD9YJyIPfoOT a1AQukXJJAjlUfUVGevD0pU4qv1jS3yDkQfLYwVTgbgKwU3UqyPoMNS2X/9kD0Koup7D lNQ6qotmXLx6/xy2Diut6+UWoCmrTFmf8NmO7JLmP8L+kCm3WKEd3kssT9ZqM/TnFHIs YbhZnZBO9YRDDmOzIOIHUnh52d70Rtyr43lrONHyAUptF9tiWaJxrs7EYIeHxYzPqZEn OiHY2qDq+idrxCSaqjAJZBNFslpwmHnCY6prowsPpEz+XI5hVbNUNjxrwODLg7fpfWoy Ak5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IWo+BA70; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eh12-20020a056a00808c00b0066e4ceca385si1663480pfb.247.2023.07.06.08.49.47; Thu, 06 Jul 2023 08:50:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IWo+BA70; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbjGFPrT (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Thu, 6 Jul 2023 11:47:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232160AbjGFPrQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Jul 2023 11:47:16 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB8521992 for <linux-kernel@vger.kernel.org>; Thu, 6 Jul 2023 08:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688658393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w2IfnXMZqwx1Jn18is50whUi5yxeZ3Kn4EXboxrstks=; b=IWo+BA70k7tVWmiXIm5ubXGXBcQNBGNnsQVYTIYzQeGlTR+2P8/hu/sTTxvY3OqIBzqtEE 37Jxrx4l/vqtnJju+GfOyDSxVoJc65XsSl+ZSBVMDGP0nrwppibOt+FQluEm4BP2nfEIdU AFkJuNCCz0xZMgmYyqS5STAqZWNMg2w= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-49-RU_tALYvP5a7WTS2Ws1CNg-1; Thu, 06 Jul 2023 11:46:27 -0400 X-MC-Unique: RU_tALYvP5a7WTS2Ws1CNg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DAE023815EF8; Thu, 6 Jul 2023 15:46:26 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-39.pek2.redhat.com [10.72.12.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47CFFF5CF0; Thu, 6 Jul 2023 15:46:18 +0000 (UTC) From: Baoquan He <bhe@redhat.com> To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, linux-mm@kvack.org, arnd@arndb.de, hch@lst.de, christophe.leroy@csgroup.eu, rppt@kernel.org, willy@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, shorne@gmail.com, David.Laight@ACULAB.COM, deller@gmx.de, nathan@kernel.org, glaubitz@physik.fu-berlin.de, Baoquan He <bhe@redhat.com> Subject: [PATCH v8 06/19] mm/ioremap: add slab availability checking in ioremap_prot Date: Thu, 6 Jul 2023 23:45:07 +0800 Message-Id: <20230706154520.11257-7-bhe@redhat.com> In-Reply-To: <20230706154520.11257-1-bhe@redhat.com> References: <20230706154520.11257-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770686898501498076?= X-GMAIL-MSGID: =?utf-8?q?1770686898501498076?= |
Series |
mm: ioremap: Convert architectures to take GENERIC_IOREMAP way
|
|
Commit Message
Baoquan He
July 6, 2023, 3:45 p.m. UTC
Several architectures has done checking if slab if available in ioremap_prot(). In fact it should be done in generic ioremap_prot() since on any architecutre, slab allocator must be available before get_vm_area_caller() and vunmap() are used. Add the checking into generic_ioremap_prot(). Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Baoquan He <bhe@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org> --- mm/ioremap.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/mm/ioremap.c b/mm/ioremap.c index 9f34a8f90b58..86b82ec27d2b 100644 --- a/mm/ioremap.c +++ b/mm/ioremap.c @@ -18,6 +18,10 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size, phys_addr_t last_addr; struct vm_struct *area; + /* An early platform driver might end up here */ + if (WARN_ON_ONCE(!slab_is_available())) + return NULL; + /* Disallow wrap-around or zero size */ last_addr = phys_addr + size - 1; if (!size || last_addr < phys_addr)