aboutsummaryrefslogtreecommitdiff
path: root/hdata
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2017-10-05 14:37:55 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-10-10 13:36:17 +1100
commit7b51ce6fab530fa5d6b2d638dcaf5e3311bfc1a6 (patch)
tree04184f353865dd2b7cf4e12ca3ad004fb221d990 /hdata
parent19d4f98e9483e4c1cae1d5a59491d8ab4f9a6e7f (diff)
downloadskiboot-7b51ce6fab530fa5d6b2d638dcaf5e3311bfc1a6.zip
skiboot-7b51ce6fab530fa5d6b2d638dcaf5e3311bfc1a6.tar.gz
skiboot-7b51ce6fab530fa5d6b2d638dcaf5e3311bfc1a6.tar.bz2
hdata/iohub: Check IOHUB child count before using
..else we endup getting below calltrace in older system. [ 169.179598388,3] HDIF: child array idx out of range! CPU 085c Backtrace: S: 0000000033d739b0 R: 00000000300136e8 .backtrace+0x40 S: 0000000033d73a50 R: 00000000300a1510 .HDIF_child_arr+0x34 S: 0000000033d73ac0 R: 00000000300a47a8 .io_parse+0x708 S: 0000000033d73c80 R: 000000003009f4ec .parse_hdat+0x177c S: 0000000033d73e30 R: 0000000030014750 .main_cpu_entry+0x148 S: 0000000033d73f00 R: 0000000030002690 boot_entry+0x198 Fixes: ad484081 (hdata: Parse IOSLOT information) CC: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r--hdata/iohub.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hdata/iohub.c b/hdata/iohub.c
index 4c4178d..134fa04 100644
--- a/hdata/iohub.c
+++ b/hdata/iohub.c
@@ -790,7 +790,7 @@ static struct dt_node *get_slot_node(void)
return slots;
}
-static void io_parse_slots(const void *sp_iohubs, int hub_id)
+static void io_parse_slots(const struct HDIF_common_hdr *sp_iohubs, int hub_id)
{
const struct HDIF_child_ptr *ioslot_arr;
const struct HDIF_array_hdr *entry_arr;
@@ -798,6 +798,9 @@ static void io_parse_slots(const void *sp_iohubs, int hub_id)
const struct slot_map_entry *entry;
unsigned int i, count;
+ if (sp_iohubs->child_count <= CECHUB_CHILD_IOSLOTS)
+ return;
+
ioslot_arr = HDIF_child_arr(sp_iohubs, CECHUB_CHILD_IOSLOTS);
if (!ioslot_arr)
return;