[Skiboot] [PATCH 1/6] xive: Check for valid PIR index when decoding

Russell Currey ruscur at russell.cc
Thu Aug 10 16:58:38 AEST 2017


This fixes an unlikely but possible assert() fail on kdump.

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Signed-off-by: Russell Currey <ruscur at russell.cc>
---
 hw/xive.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/xive.c b/hw/xive.c
index 03b9478e..18636723 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -601,6 +601,8 @@ static bool xive_decode_vp(uint32_t vp, uint32_t *blk, uint32_t *idx,
 
 	/* PIR case */
 	if (((vp >> 30) & 1) == 0) {
+		if (find_cpu_by_pir(index) == NULL)
+			return false;
 		if (blk)
 			*blk = PIR2VP_BLK(index);
 		if (idx)
@@ -656,6 +658,8 @@ static bool xive_decode_vp(uint32_t vp, uint32_t *blk, uint32_t *idx,
 
 	/* PIR case */
 	if (((vp >> 30) & 1) == 0) {
+		if (find_cpu_by_pir(index) == NULL)
+			return false;
 		if (blk)
 			*blk = PIR2VP_BLK(index);
 		if (idx)
-- 
2.14.0



More information about the Skiboot mailing list