From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE933C54EBD for ; Wed, 4 Jan 2023 16:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239500AbjADQMT (ORCPT ); Wed, 4 Jan 2023 11:12:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239905AbjADQLg (ORCPT ); Wed, 4 Jan 2023 11:11:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F2CA1DDD9 for ; Wed, 4 Jan 2023 08:11:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C715DB81730 for ; Wed, 4 Jan 2023 16:11:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 257EFC433F0; Wed, 4 Jan 2023 16:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672848671; bh=OLjrCg7gU2oIEd4+JZIfSItkyt05E6WU+Zqd4grtruw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4TILi/RD219387Ru8vUnkAGSQ0MsFXChLVOkTmgv6ogTFdNS/8Q3m7wl/L5crzyH bnrXT0ragl80YakUsp63ARoUhX0FdTfStus5lhYeMuiJg4IYpMnMhV232DW0dGVTbm I5GTMvhtAQ7X5bXcv2g2OxPLhlTYPv1QEsyhYDN0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Davidlohr Bueso , Dave Jiang , Jonathan Cameron , Dan Williams Subject: [PATCH 6.1 028/207] cxl/region: Fix missing probe failure Date: Wed, 4 Jan 2023 17:04:46 +0100 Message-Id: <20230104160512.807273692@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230104160511.905925875@linuxfoundation.org> References: <20230104160511.905925875@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dan Williams commit bf3e5da8cb43a671b32fc125fa81b8f6a3677192 upstream. cxl_region_probe() allows for regions not in the 'commit' state to be enabled. Fail probe when the region is not committed otherwise the kernel may indicate that an address range is active when none of the decoders are active. Fixes: 8d48817df6ac ("cxl/region: Add region driver boiler plate") Cc: Reviewed-by: Davidlohr Bueso Reviewed-by: Dave Jiang Reviewed-by: Jonathan Cameron Link: https://lore.kernel.org/r/166993220462.1995348.1698008475198427361.stgit@dwillia2-xfh.jf.intel.com Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/cxl/core/region.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1923,6 +1923,9 @@ static int cxl_region_probe(struct devic */ up_read(&cxl_region_rwsem); + if (rc) + return rc; + switch (cxlr->mode) { case CXL_DECODER_PMEM: return devm_cxl_add_pmem_region(cxlr);