cxl/hdm: Fail upon detecting 0-sized decoders
authorDan Williams <dan.j.williams@intel.com>
Fri, 14 Apr 2023 18:53:55 +0000 (11:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:05 +0000 (23:03 +0900)
commita6f5c84b41aa8514b4b7a89e2c41eed5f2f21df5
treece9cbd6893f7c89ee8ae0da41779b564fd815f2b
parent0ae98a8b4f00644f0d5ec185e108d798ed8f0874
cxl/hdm: Fail upon detecting 0-sized decoders

commit 7701c8bef4f14bd9f7940c6ed0e6a73584115a96 upstream.

Decoders committed with 0-size lead to later crashes on shutdown as
__cxl_dpa_release() assumes a 'struct resource' has been established in
the in 'cxlds->dpa_res'. Just fail the driver load in this instance
since there are deeper problems with the enumeration or the setup when
this happens.

Fixes: 9c57cde0dcbd ("cxl/hdm: Enumerate allocated DPA")
Cc: <stable@vger.kernel.org>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Link: https://lore.kernel.org/r/168149843516.792294.11872242648319572632.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/hdm.c