Message ID | 20230216123419.461016-6-bhe@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp276795wrn; Thu, 16 Feb 2023 04:42:10 -0800 (PST) X-Google-Smtp-Source: AK7set8B8t8Ct+QENzdcgfuHO5pGFBG42e1KblM+8VKo1tKpY4a7plAaSXMZPf3Wcnk6UghL4gA1 X-Received: by 2002:a17:90b:1c08:b0:233:de54:4847 with SMTP id oc8-20020a17090b1c0800b00233de544847mr2203323pjb.12.1676551330512; Thu, 16 Feb 2023 04:42:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676551330; cv=none; d=google.com; s=arc-20160816; b=u0UN+5UoNHBE1AE6n+H8joKKQWvZ6O/XnnwSI1YDTM134FRG+0tZoOcdFl+u7vicT3 OtAmkVM8R4+hwkxZMfIPy5ZbKcWXtkxAYpYS+iW9dnFFQLiH8xSGZacvCkfspYHTqxyM OrI4V1g139qGKPWPF3ygtLPIMnTdYTQ4iJwTytX/031COIp7c7zrMdVXyrNWmVGShFuu 49VYRDLH7AQZpiqkeQMcRslPK8B0xTs0Zq8bOyIIVPv4hlkMt1D1FLPAFNw0TMBGJVTz hHhiY1nefrzIWMdWHxkc6fYrpE0qfAdIYWrARxuYMiui2HTFuDSunPSu8rJ3RgTm66M+ sWSA== 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=VAS4IZuKJ+juH7iPqwkFDOy8wLE8dxFK/fb+Ylmu2PxWtHLeVh0oZ8zFStrogaYqr9 OVs+4DmXCPX0/0dL9jC90UPaMMuFQmzgeF8mTKDgGydYxLMvqU0+6Du8aKu4LJbegfk+ lIeXs0pEJWUgYydbf6vaaUIfbjWC/4wiLSzJPu2X/lPI4YWo7aQ35mkIKlh+TeRdGi+d /vLmt36BGEEF0ZgrjutN9/9IeVzGi5WPWhulxysSAP/AlF5/1A0lxD8NH+cIxYZIF6EO f8rSjdVFqeazvzfpqwnh+IRKm2ot/XGREIRPRE5GaE/i+gEz1jpaM6Tu8oPUJHiAeWC4 hj2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NihfTtCW; 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 hk13-20020a17090b224d00b0022724ce742dsi1901087pjb.75.2023.02.16.04.41.57; Thu, 16 Feb 2023 04:42:10 -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=NihfTtCW; 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 S230303AbjBPMgD (ORCPT <rfc822;aimixsaka@gmail.com> + 99 others); Thu, 16 Feb 2023 07:36:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbjBPMgB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 16 Feb 2023 07:36:01 -0500 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 BE84B5775D for <linux-kernel@vger.kernel.org>; Thu, 16 Feb 2023 04:35:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676550911; 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=NihfTtCWfMx6fzwIcC3lmMEb7TIGUp2bJOcl6DDeKZmEnpc42Wdvz3HQi00kqRanywwBTP S507OffKZGBO9HgW89PJlVMtQkiHgoa3Fqp45Cbgaj9fPYoZAVSMz+sZQb2ZeHGj0RpWrE HmLlHoN7nvbRLE/an8DPHRXI3vG2P1Y= 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-651-rRYF4ZJzMveowcX66KqSBg-1; Thu, 16 Feb 2023 07:35:07 -0500 X-MC-Unique: rRYF4ZJzMveowcX66KqSBg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0E2AE185A7A4; Thu, 16 Feb 2023 12:35:07 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-99.pek2.redhat.com [10.72.12.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D81A492C3C; Thu, 16 Feb 2023 12:34:59 +0000 (UTC) From: Baoquan He <bhe@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, 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, arnd@arndb.de, Baoquan He <bhe@redhat.com> Subject: [PATCH v4 05/16] mm/ioremap: add slab availability checking in ioremap_prot Date: Thu, 16 Feb 2023 20:34:08 +0800 Message-Id: <20230216123419.461016-6-bhe@redhat.com> In-Reply-To: <20230216123419.461016-1-bhe@redhat.com> References: <20230216123419.461016-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.9 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=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?1757991488121795653?= X-GMAIL-MSGID: =?utf-8?q?1757991488121795653?= |
Series |
mm: ioremap: Convert architectures to take GENERIC_IOREMAP way
|
|
Commit Message
Baoquan He
Feb. 16, 2023, 12:34 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>
---
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)