Message ID | 20230301034247.136007-7-bhe@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3410668wrd; Tue, 28 Feb 2023 19:46:37 -0800 (PST) X-Google-Smtp-Source: AK7set/pnhEH1yRZjvaMOab1wVAfTCQ+e+aQK8Fn6iNHvQxJF3BgdyfKZ4+HDECxrrF2uEfbzxY1 X-Received: by 2002:a05:6a20:6a1c:b0:cc:3bf0:ed71 with SMTP id p28-20020a056a206a1c00b000cc3bf0ed71mr4641288pzk.4.1677642397605; Tue, 28 Feb 2023 19:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677642397; cv=none; d=google.com; s=arc-20160816; b=GRh9Pu0YhdjG7DCwjzkDgjZO0F4HggFskaEdIUiqG9v7PJ+UgirBeFoW4ot63wi/Zv /kt7HsVjU9vhUyvhfYq9wXWZXLDopcPNLEkf90EXDjeOEiZnzLD23L4wHWantqqawINm qzXgnY+j1it8Hhg3PQ4QMSez1X4bJk5a8TyMJoP90azgUhGU4Q7VeIjlZgZNJT8AKso5 uT/MH+fd0TmHQs9Srq6CjkpKqx4CQZ5IVkca5IEo/MDJ4hNFL2VJQ1fqm/k4UnImhSIT sKSNG3Fn/TyYO7PIHeUtj15GYH7D789j5Vt+WttyQSXQzoi6T//TovP8x/aYFZSBAKJK 7lwQ== 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=b04gx2CEsZva7MKdHssokOo8Q5KwYfP6QKwltziak5c=; b=PsjqYsFnENoIDqbWu+zZec9o0YWJ6EMfC/NV/8CeFxXLaxJnBuTzWclLXWVchjnZFd JK/9dAecCSq2pjjrjlSB31Wjns6Vg3H4PE6uoGLDC26sN3oroHk7Eb4YxqvFEq541yCG er9+d0tBR3/gLsygtLhCq9O8WT/ytlBaND9JIGtOY8ShzImJK7d/3kQlHepZWzKrQKaO GIjlwlTtj6CaI3p28a2VLo90MgXyzp3OQhikCJmLY5QfXvAgEJdWyvM5GZ7dj4Tkx+bD RfRsMjlFmdI7TIW/esPXC0tvLqUrXdTtGRlaUe7WDNija3Vn1sT+YEKUYyVahvTGev8S b3Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B9Hdhn9O; 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 j16-20020a633c10000000b00502f45245cbsi11428718pga.288.2023.02.28.19.46.24; Tue, 28 Feb 2023 19:46:37 -0800 (PST) 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=B9Hdhn9O; 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 S229942AbjCADox (ORCPT <rfc822;aaron.seo0120@gmail.com> + 99 others); Tue, 28 Feb 2023 22:44:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbjCADoa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Feb 2023 22:44:30 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7791E30E96 for <linux-kernel@vger.kernel.org>; Tue, 28 Feb 2023 19:43:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677642220; 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=b04gx2CEsZva7MKdHssokOo8Q5KwYfP6QKwltziak5c=; b=B9Hdhn9OgHuZiCNeydberQXGrIGpLu4oNoDapz/6qsiVQH6+OVEAyHIN2WgcEVL5eDc7gq +S6thCunXnt1D7BQ7U4z7Kqvw260SSYeaeyaKq1lDq3GdlMp2hnDpPPl5xUyJp6+OMe4M6 6D80Q+t2SqKISGlN6CHRAOx+vUDqUJs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-434-8Y9zFz3EOyOEh-jq97Zmzw-1; Tue, 28 Feb 2023 22:43:34 -0500 X-MC-Unique: 8Y9zFz3EOyOEh-jq97Zmzw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 61920811E6E; Wed, 1 Mar 2023 03:43:33 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-13-180.pek2.redhat.com [10.72.13.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id D76C3C15BAD; Wed, 1 Mar 2023 03:43:28 +0000 (UTC) From: Baoquan He <bhe@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, arnd@arndb.de, christophe.leroy@csgroup.eu, hch@infradead.org, agordeev@linux.ibm.com, wangkefeng.wang@huawei.com, schnelle@linux.ibm.com, David.Laight@ACULAB.COM, shorne@gmail.com, willy@infradead.org, Baoquan He <bhe@redhat.com> Subject: [PATCH v5 06/17] mm/ioremap: add slab availability checking in ioremap_prot Date: Wed, 1 Mar 2023 11:42:36 +0800 Message-Id: <20230301034247.136007-7-bhe@redhat.com> In-Reply-To: <20230301034247.136007-1-bhe@redhat.com> References: <20230301034247.136007-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.8 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_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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?1759135554612057010?= X-GMAIL-MSGID: =?utf-8?q?1759135554612057010?= |
Series |
mm: ioremap: Convert architectures to take GENERIC_IOREMAP way
|
|
Commit Message
Baoquan He
March 1, 2023, 3:42 a.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>
---
mm/ioremap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/ioremap.c b/mm/ioremap.c index 9f34a8f90b58..2fbe6b9bc50e 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 (!slab_is_available()) + return NULL; + /* Disallow wrap-around or zero size */ last_addr = phys_addr + size - 1; if (!size || last_addr < phys_addr)