Skip to content

Commit 0a70b7c

Browse files
AlisonSchofielddavejiang
authored andcommitted
cxl: Test CXL_DECODER_F_LOCK as a bitmask
The CXL decoder flags are defined as bitmasks, not bit indices. Using test_bit() to check them interprets the mask value as a bit index, which is the wrong test. For CXL_DECODER_F_LOCK the test reads beyond the defined bits, causing the test to always return false and allowing resets that should have been blocked. Replace test_bit() with a bitmask check. Fixes: 2230c4b ("cxl: Add handling of locked CXL decoder") Signed-off-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Gregory Price <gourry@gourry.net> Tested-by: Gregory Price <gourry@gourry.net> Link: https://patch.msgid.link/98851c4770e4631753cf9f75b58a3a6daeca2ea2.1771873256.git.alison.schofield@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 60b5d1f commit 0a70b7c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/cxl/core/hdm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ static void cxl_decoder_reset(struct cxl_decoder *cxld)
904904
if ((cxld->flags & CXL_DECODER_F_ENABLE) == 0)
905905
return;
906906

907-
if (test_bit(CXL_DECODER_F_LOCK, &cxld->flags))
907+
if (cxld->flags & CXL_DECODER_F_LOCK)
908908
return;
909909

910910
if (port->commit_end == id)

drivers/cxl/core/region.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ static int cxl_rr_assign_decoder(struct cxl_port *port, struct cxl_region *cxlr,
11001100
static void cxl_region_setup_flags(struct cxl_region *cxlr,
11011101
struct cxl_decoder *cxld)
11021102
{
1103-
if (test_bit(CXL_DECODER_F_LOCK, &cxld->flags)) {
1103+
if (cxld->flags & CXL_DECODER_F_LOCK) {
11041104
set_bit(CXL_REGION_F_LOCK, &cxlr->flags);
11051105
clear_bit(CXL_REGION_F_NEEDS_RESET, &cxlr->flags);
11061106
}

0 commit comments

Comments
 (0)