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

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