Blame SOURCES/0214-cxl-region-fix-a-dereferecnce-after-NULL-check.patch

26ccd9
From cc2766399882001880a899e723c7bd968e60f100 Mon Sep 17 00:00:00 2001
26ccd9
From: Vishal Verma <vishal.l.verma@intel.com>
26ccd9
Date: Tue, 23 Aug 2022 01:45:25 -0600
26ccd9
Subject: [PATCH 214/217] cxl/region: fix a dereferecnce after NULL check
26ccd9
26ccd9
A NULL check in region_action() implies that 'decoder' might be NULL, but
26ccd9
later we dereference it during cxl_decoder_foreach(). The NULL check is
26ccd9
valid because it was the filter result being checked, however, while
26ccd9
doing this, the original 'decoder' variable was being clobbered.
26ccd9
26ccd9
Check the filter results independently of the original decoder variable.
26ccd9
26ccd9
Link: https://lore.kernel.org/r/20220823074527.404435-2-vishal.l.verma@intel.com
26ccd9
Cc: Dan Williams <dan.j.williams@intel.com>
26ccd9
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
26ccd9
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
26ccd9
---
26ccd9
 cxl/region.c | 5 ++---
26ccd9
 1 file changed, 2 insertions(+), 3 deletions(-)
26ccd9
26ccd9
diff --git a/cxl/region.c b/cxl/region.c
26ccd9
index a30313c..334fcc2 100644
26ccd9
--- a/cxl/region.c
26ccd9
+++ b/cxl/region.c
26ccd9
@@ -686,9 +686,8 @@ static int region_action(int argc, const char **argv, struct cxl_ctx *ctx,
26ccd9
 			continue;
26ccd9
 
26ccd9
 		cxl_decoder_foreach (port, decoder) {
26ccd9
-			decoder = util_cxl_decoder_filter(decoder,
26ccd9
-							  param.root_decoder);
26ccd9
-			if (!decoder)
26ccd9
+			if (!util_cxl_decoder_filter(decoder,
26ccd9
+						     param.root_decoder))
26ccd9
 				continue;
26ccd9
 			rc = decoder_region_action(p, decoder, action, count);
26ccd9
 			if (rc)
26ccd9
-- 
26ccd9
2.27.0
26ccd9