Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 2230c4bdc412 ("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>

authored by

Alison Schofield and committed by
Dave Jiang
0a70b7cd 60b5d1f6

+2 -2
+1 -1
drivers/cxl/core/hdm.c
··· 904 904 if ((cxld->flags & CXL_DECODER_F_ENABLE) == 0) 905 905 return; 906 906 907 - if (test_bit(CXL_DECODER_F_LOCK, &cxld->flags)) 907 + if (cxld->flags & CXL_DECODER_F_LOCK) 908 908 return; 909 909 910 910 if (port->commit_end == id)
+1 -1
drivers/cxl/core/region.c
··· 1100 1100 static void cxl_region_setup_flags(struct cxl_region *cxlr, 1101 1101 struct cxl_decoder *cxld) 1102 1102 { 1103 - if (test_bit(CXL_DECODER_F_LOCK, &cxld->flags)) { 1103 + if (cxld->flags & CXL_DECODER_F_LOCK) { 1104 1104 set_bit(CXL_REGION_F_LOCK, &cxlr->flags); 1105 1105 clear_bit(CXL_REGION_F_NEEDS_RESET, &cxlr->flags); 1106 1106 }