]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cxl/region: Fix missing probe failure
authorDan Williams <dan.j.williams@intel.com>
Thu, 1 Dec 2022 22:03:24 +0000 (14:03 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jan 2023 10:15:45 +0000 (11:15 +0100)
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: <stable@vger.kernel.org>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/166993220462.1995348.1698008475198427361.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cxl/core/region.c

index dbf3413aa6178d6ca67b855d682a165d24b826d1..36ef236354557fec6f80dd2cc6bd5228273a6efb 100644 (file)
@@ -1922,6 +1922,9 @@ static int cxl_region_probe(struct device *dev)
         */
        up_read(&cxl_region_rwsem);
 
+       if (rc)
+               return rc;
+
        switch (cxlr->mode) {
        case CXL_DECODER_PMEM:
                return devm_cxl_add_pmem_region(cxlr);