aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/powerpc/platforms/pseries/of_helpers.c
diff options
context:
space:
mode:
authorTyrel Datwyler <tyreld@linux.ibm.com>2020-03-06 20:45:47 -0600
committerMichael Ellerman <mpe@ellerman.id.au>2020-03-25 12:06:43 +1100
commitc5e76fa05b2df519b9f08571cc57e623c1569faa (patch)
treee4791e2f0c4daee2f6092a144f0b3d269d6f9312 /arch/powerpc/platforms/pseries/of_helpers.c
parentselftests/powerpc: Don't rely on segfault to rerun the test (diff)
downloadwireguard-linux-c5e76fa05b2df519b9f08571cc57e623c1569faa.tar.xz
wireguard-linux-c5e76fa05b2df519b9f08571cc57e623c1569faa.zip
powerpc/pseries: Fix of_read_drc_info_cell() to point at next record
The expectation is that when calling of_read_drc_info_cell() repeatedly to parse multiple drc-info records that the in/out curval parameter points at the start of the next record on return. However, the current behavior has curval still pointing at the final value of the record just parsed. The result of which is that if the ibm,drc-info property contains multiple properties the parsed value of the drc_type for any record after the first has the power_domain value of the previous record appended to the type string. eg: observed the following 0xffffffff prepended to PHB drc-info: type: \xff\xff\xff\xffPHB, prefix: PHB , index_start: 0x20000001 drc-info: suffix_start: 1, sequential_elems: 3072, sequential_inc: 1 drc-info: power-domain: 0xffffffff, last_index: 0x20000c00 In practice PHBs are the only type of connector in the ibm,drc-info property that has multiple records. So, it breaks PHB hotplug, but by chance not PCI, CPU, slot, or memory because they happen to only ever be a single record. Fix by incrementing curval past the power_domain value to point at drc_type string of next record. Fixes: e83636ac3334 ("pseries/drc-info: Search DRC properties for CPU indexes") Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com> Acked-by: Nathan Lynch <nathanl@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200307024547.5748-1-tyreld@linux.ibm.com
Diffstat (limited to 'arch/powerpc/platforms/pseries/of_helpers.c')
-rw-r--r--arch/powerpc/platforms/pseries/of_helpers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/pseries/of_helpers.c b/arch/powerpc/platforms/pseries/of_helpers.c
index 66dfd8256712..23241c71ef37 100644
--- a/arch/powerpc/platforms/pseries/of_helpers.c
+++ b/arch/powerpc/platforms/pseries/of_helpers.c
@@ -88,7 +88,7 @@ int of_read_drc_info_cell(struct property **prop, const __be32 **curval,
return -EINVAL;
/* Should now know end of current entry */
- (*curval) = (void *)p2;
+ (*curval) = (void *)(++p2);
data->last_drc_index = data->drc_index_start +
((data->num_sequential_elems - 1) * data->sequential_inc);