Similar to commit 89c140bbaeee ("pseries: Fix 64 bit logical memory block panic")
make sure different variables tracking lmb_size are updated to be 64 bit.
This was found by code audit.
Cc: stable@vger.kernel.org
Signed-off-by: Aneesh Kumar K.V <redacted>
---
arch/powerpc/include/asm/drmem.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
dt_root_addr_cells and dt_root_size_cells are __initdata variables.
So make a copy of the same which can be used post init.
Signed-off-by: Aneesh Kumar K.V <redacted>
---
arch/powerpc/include/asm/drmem.h | 2 ++
arch/powerpc/kernel/prom.c | 7 +++++++
arch/powerpc/mm/numa.c | 1 +
3 files changed, 10 insertions(+)
*lmb)
}
#endif
+extern int mem_addr_cells, mem_size_cells;
Should this be in include/asm/prom.h instead, given the definition
comes from kernel/prom.c file?
We added the variable definition to prom.c because that is where we are
doing early device tree scanning. But the users should not really be
including prom.h. The variables are related drmem and hence I used
drmem.h for include.
*n_addr_cells, int *n_size_cells)
of_node_put(memory);
}
+/* dt_mem_next_cell is __init */
static unsigned long read_n_cells(int n, const __be32 **buf)
{
unsigned long result = 0;
Similar to commit 89c140bbaeee ("pseries: Fix 64 bit logical memory block panic")
make sure different variables tracking lmb_size are updated to be 64 bit.
This was found by code audit.
Cc: stable@vger.kernel.org
Signed-off-by: Aneesh Kumar K.V <redacted>
---
.../platforms/pseries/hotplug-memory.c | 37 +++++++++++--------
1 file changed, 22 insertions(+), 15 deletions(-)
@@ -277,7 +277,7 @@ static int dlpar_offline_lmb(struct drmem_lmb *lmb)returndlpar_change_lmb_state(lmb,false);}-staticintpseries_remove_memblock(unsignedlongbase,unsignedintmemblock_size)+staticintpseries_remove_memblock(unsignedlongbase,unsignedlongmemblock_size){unsignedlongblock_sz,start_pfn;intsections_per_block;
@@ -308,9 +308,9 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_sizstaticintpseries_remove_mem_node(structdevice_node*np){-const__be32*regs;+const__be32*prop;unsignedlongbase;-unsignedintlmb_size;+unsignedlonglmb_size;intret=-EINVAL;/*
@@ -322,12 +322,16 @@ static int pseries_remove_mem_node(struct device_node *np)/**Findthebaseaddressandsizeofthememblock*/-regs=of_get_property(np,"reg",NULL);-if(!regs)+prop=of_get_property(np,"reg",NULL);+if(!prop)returnret;-base=be64_to_cpu(*(unsignedlong*)regs);-lmb_size=be32_to_cpu(regs[3]);+/*+*"reg"propertyrepresents(addr,size)tuple.+*/+base=of_read_number(prop,mem_addr_cells);+prop+=mem_addr_cells;+lmb_size=of_read_number(prop,mem_size_cells);pseries_remove_memblock(base,lmb_size);return0;
@@ -557,7 +561,7 @@ static int dlpar_memory_remove_by_ic(u32 lmbs_to_remove, u32 drc_index)#elsestaticinlineintpseries_remove_memblock(unsignedlongbase,-unsignedintmemblock_size)+unsignedlongmemblock_size){return-EOPNOTSUPP;}
@@ -878,9 +882,9 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)staticintpseries_add_mem_node(structdevice_node*np){-const__be32*regs;+const__be32*prop;unsignedlongbase;-unsignedintlmb_size;+unsignedlonglmb_size;intret=-EINVAL;/*
@@ -892,12 +896,15 @@ static int pseries_add_mem_node(struct device_node *np)/**Findthebaseandsizeofthememblock*/-regs=of_get_property(np,"reg",NULL);-if(!regs)+prop=of_get_property(np,"reg",NULL);+if(!prop)returnret;--base=be64_to_cpu(*(unsignedlong*)regs);-lmb_size=be32_to_cpu(regs[3]);+/*+*"reg"propertyrepresents(addr,size)tuple.+*/+base=of_read_number(prop,mem_addr_cells);+prop+=mem_addr_cells;+lmb_size=of_read_number(prop,mem_size_cells);/**Updatememoryregiontorepresentthememoryadd
Hi
[This is an automated email]
This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.8, v5.7.14, v5.4.57, v4.19.138, v4.14.193, v4.9.232, v4.4.232.
v5.8: Build OK!
v5.7.14: Build OK!
v5.4.57: Build OK!
v4.19.138: Failed to apply! Possible dependencies:
Unable to calculate
v4.14.193: Failed to apply! Possible dependencies:
Unable to calculate
v4.9.232: Failed to apply! Possible dependencies:
1a367063ca0c ("powerpc/pseries: Check memory device state before onlining/offlining")
25b587fba9a4 ("powerpc/pseries: Correct possible read beyond dlpar sysfs buffer")
333f7b76865b ("powerpc/pseries: Implement indexed-count hotplug memory add")
753843471cbb ("powerpc/pseries: Implement indexed-count hotplug memory remove")
943db62c316c ("powerpc/pseries: Revert 'Auto-online hotplugged memory'")
c21f515c7436 ("powerpc/pseries: Make the acquire/release of the drc for memory a seperate step")
e70d59700fc3 ("powerpc/pseries: Introduce memory hotplug READD operation")
f84775c2d5d9 ("powerpc/pseries: Fix build break when MEMORY_HOTREMOVE=n")
v4.4.232: Failed to apply! Possible dependencies:
183deeea5871 ("powerpc/pseries: Consolidate CPU hotplug code to hotplug-cpu.c")
1a367063ca0c ("powerpc/pseries: Check memory device state before onlining/offlining")
1dc759566636 ("powerpc/pseries: Use kernel hotplug queue for PowerVM hotplug events")
1f859adb9253 ("powerpc/pseries: Verify CPU doesn't exist before adding")
25b587fba9a4 ("powerpc/pseries: Correct possible read beyond dlpar sysfs buffer")
333f7b76865b ("powerpc/pseries: Implement indexed-count hotplug memory add")
4a4bdfea7cb7 ("powerpc/pseries: Refactor dlpar_add_lmb() code")
753843471cbb ("powerpc/pseries: Implement indexed-count hotplug memory remove")
9054619ef54a ("powerpc/pseries: Add pseries hotplug workqueue")
943db62c316c ("powerpc/pseries: Revert 'Auto-online hotplugged memory'")
9dc512819e4b ("powerpc: Fix unused function warning 'lmb_to_memblock'")
bdf5fc633804 ("powerpc/pseries: Update LMB associativity index during DLPAR add/remove")
c21f515c7436 ("powerpc/pseries: Make the acquire/release of the drc for memory a seperate step")
e70d59700fc3 ("powerpc/pseries: Introduce memory hotplug READD operation")
e9d764f80396 ("powerpc/pseries: Enable kernel CPU dlpar from sysfs")
ec999072442a ("powerpc/pseries: Auto-online hotplugged memory")
f84775c2d5d9 ("powerpc/pseries: Fix build break when MEMORY_HOTREMOVE=n")
fdb4f6e99ffa ("powerpc/pseries: Remove call to memblock_add()")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
--
Thanks
Sasha
Hi
[This is an automated email]
This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.8.1, v5.7.15, v5.4.58, v4.19.139, v4.14.193, v4.9.232, v4.4.232.
v5.8.1: Build OK!
v5.7.15: Build OK!
v5.4.58: Build OK!
v4.19.139: Failed to apply! Possible dependencies:
Unable to calculate
v4.14.193: Failed to apply! Possible dependencies:
Unable to calculate
v4.9.232: Failed to apply! Possible dependencies:
1a367063ca0c ("powerpc/pseries: Check memory device state before onlining/offlining")
25b587fba9a4 ("powerpc/pseries: Correct possible read beyond dlpar sysfs buffer")
333f7b76865b ("powerpc/pseries: Implement indexed-count hotplug memory add")
753843471cbb ("powerpc/pseries: Implement indexed-count hotplug memory remove")
943db62c316c ("powerpc/pseries: Revert 'Auto-online hotplugged memory'")
c21f515c7436 ("powerpc/pseries: Make the acquire/release of the drc for memory a seperate step")
e70d59700fc3 ("powerpc/pseries: Introduce memory hotplug READD operation")
f84775c2d5d9 ("powerpc/pseries: Fix build break when MEMORY_HOTREMOVE=n")
v4.4.232: Failed to apply! Possible dependencies:
183deeea5871 ("powerpc/pseries: Consolidate CPU hotplug code to hotplug-cpu.c")
1a367063ca0c ("powerpc/pseries: Check memory device state before onlining/offlining")
1dc759566636 ("powerpc/pseries: Use kernel hotplug queue for PowerVM hotplug events")
1f859adb9253 ("powerpc/pseries: Verify CPU doesn't exist before adding")
25b587fba9a4 ("powerpc/pseries: Correct possible read beyond dlpar sysfs buffer")
333f7b76865b ("powerpc/pseries: Implement indexed-count hotplug memory add")
4a4bdfea7cb7 ("powerpc/pseries: Refactor dlpar_add_lmb() code")
753843471cbb ("powerpc/pseries: Implement indexed-count hotplug memory remove")
9054619ef54a ("powerpc/pseries: Add pseries hotplug workqueue")
943db62c316c ("powerpc/pseries: Revert 'Auto-online hotplugged memory'")
9dc512819e4b ("powerpc: Fix unused function warning 'lmb_to_memblock'")
bdf5fc633804 ("powerpc/pseries: Update LMB associativity index during DLPAR add/remove")
c21f515c7436 ("powerpc/pseries: Make the acquire/release of the drc for memory a seperate step")
e70d59700fc3 ("powerpc/pseries: Introduce memory hotplug READD operation")
e9d764f80396 ("powerpc/pseries: Enable kernel CPU dlpar from sysfs")
ec999072442a ("powerpc/pseries: Auto-online hotplugged memory")
f84775c2d5d9 ("powerpc/pseries: Fix build break when MEMORY_HOTREMOVE=n")
fdb4f6e99ffa ("powerpc/pseries: Remove call to memblock_add()")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
--
Thanks
Sasha
Hi
[This is an automated email]
This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.8.2, v5.7.16, v5.4.59, v4.19.140, v4.14.193, v4.9.232, v4.4.232.
v5.8.2: Build OK!
v5.7.16: Build OK!
v5.4.59: Build OK!
v4.19.140: Failed to apply! Possible dependencies:
Unable to calculate
v4.14.193: Failed to apply! Possible dependencies:
Unable to calculate
v4.9.232: Failed to apply! Possible dependencies:
1a367063ca0c ("powerpc/pseries: Check memory device state before onlining/offlining")
25b587fba9a4 ("powerpc/pseries: Correct possible read beyond dlpar sysfs buffer")
333f7b76865b ("powerpc/pseries: Implement indexed-count hotplug memory add")
753843471cbb ("powerpc/pseries: Implement indexed-count hotplug memory remove")
943db62c316c ("powerpc/pseries: Revert 'Auto-online hotplugged memory'")
c21f515c7436 ("powerpc/pseries: Make the acquire/release of the drc for memory a seperate step")
e70d59700fc3 ("powerpc/pseries: Introduce memory hotplug READD operation")
f84775c2d5d9 ("powerpc/pseries: Fix build break when MEMORY_HOTREMOVE=n")
v4.4.232: Failed to apply! Possible dependencies:
183deeea5871 ("powerpc/pseries: Consolidate CPU hotplug code to hotplug-cpu.c")
1a367063ca0c ("powerpc/pseries: Check memory device state before onlining/offlining")
1dc759566636 ("powerpc/pseries: Use kernel hotplug queue for PowerVM hotplug events")
1f859adb9253 ("powerpc/pseries: Verify CPU doesn't exist before adding")
25b587fba9a4 ("powerpc/pseries: Correct possible read beyond dlpar sysfs buffer")
333f7b76865b ("powerpc/pseries: Implement indexed-count hotplug memory add")
4a4bdfea7cb7 ("powerpc/pseries: Refactor dlpar_add_lmb() code")
753843471cbb ("powerpc/pseries: Implement indexed-count hotplug memory remove")
9054619ef54a ("powerpc/pseries: Add pseries hotplug workqueue")
943db62c316c ("powerpc/pseries: Revert 'Auto-online hotplugged memory'")
9dc512819e4b ("powerpc: Fix unused function warning 'lmb_to_memblock'")
bdf5fc633804 ("powerpc/pseries: Update LMB associativity index during DLPAR add/remove")
c21f515c7436 ("powerpc/pseries: Make the acquire/release of the drc for memory a seperate step")
e70d59700fc3 ("powerpc/pseries: Introduce memory hotplug READD operation")
e9d764f80396 ("powerpc/pseries: Enable kernel CPU dlpar from sysfs")
ec999072442a ("powerpc/pseries: Auto-online hotplugged memory")
f84775c2d5d9 ("powerpc/pseries: Fix build break when MEMORY_HOTREMOVE=n")
fdb4f6e99ffa ("powerpc/pseries: Remove call to memblock_add()")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
--
Thanks
Sasha
Hi
[This is an automated email]
This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.8.1, v5.7.15, v5.4.58, v4.19.139, v4.14.193, v4.9.232, v4.4.232.
v5.8.1: Build OK!
v5.7.15: Build OK!
v5.4.58: Build OK!
v4.19.139: Build OK!
v4.14.193: Failed to apply! Possible dependencies:
22508f3dc985 ("powerpc/numa: Look up device node in of_get_usable_memory()")
2c77721552e5 ("powerpc: Move of_drconf_cell struct to asm/drmem.h")
35f80debaef0 ("powerpc/numa: Look up device node in of_get_assoc_arrays()")
514a9cb3316a ("powerpc/numa: Update numa code use walk_drmem_lmbs")
6195a5001f1d ("powerpc/pseries: Update memory hotplug code to use drmem LMB array")
6c6ea53725b3 ("powerpc/mm: Separate ibm, dynamic-memory data from DT format")
b6eca183e23e ("powerpc/kernel: Enables memory hot-remove after reboot on pseries guests")
b88fc309d6ad ("powerpc/numa: Look up associativity array in of_drconf_to_nid_single")
v4.9.232: Failed to apply! Possible dependencies:
3a2df3798d4d ("powerpc/mm: Make switch_mm_irqs_off() out of line")
43ed84a891b7 ("powerpc/mm: Move pgdir setting into a helper")
5a61ef74f269 ("powerpc/64s: Support new device tree binding for discovering CPU features")
5d451a87e5eb ("powerpc/64: Retrieve number of L1 cache sets from device-tree")
6c6ea53725b3 ("powerpc/mm: Separate ibm, dynamic-memory data from DT format")
70cd4c10b290 ("KVM: PPC: Book3S HV: Fix software walk of guest process page tables")
9b081e10805c ("powerpc: port 64 bits pgtable_cache to 32 bits")
a25bd72badfa ("powerpc/mm/radix: Workaround prefetch issue with KVM")
bd067f83b084 ("powerpc/64: Fix naming of cache block vs. cache line")
dbcbfee0c81c ("powerpc/64: More definitions for POWER9")
e2827fe5c156 ("powerpc/64: Clean up ppc64_caches using a struct per cache")
f4329f2ecb14 ("powerpc/64s: Reduce exception alignment")
v4.4.232: Failed to apply! Possible dependencies:
11a6f6abd74a ("powerpc/mm: Move radix/hash common data structures to book3s64 headers")
26b6a3d9bb48 ("powerpc/mm: move pte headers to book3s directory")
3808a88985b4 ("powerpc: Move FW feature probing out of pseries probe()")
3dfcb315d81e ("powerpc/mm: make a separate copy for book3s")
5a61ef74f269 ("powerpc/64s: Support new device tree binding for discovering CPU features")
5d31a96e6c01 ("powerpc/livepatch: Add livepatch stack to struct thread_info")
6574ba950bbe ("powerpc/kernel: Convert cpu_has_feature() to returning bool")
6c6ea53725b3 ("powerpc/mm: Separate ibm, dynamic-memory data from DT format")
a141cca3892b ("powerpc/mm: Add early_[cpu|mmu]_has_feature()")
a8ed87c92adf ("powerpc/mm/radix: Add MMU_FTR_RADIX")
b92a226e5284 ("powerpc: Move cpu_has_feature() to a separate file")
da6a97bf12d5 ("powerpc: Move epapr_paravirt_early_init() to early_init_devtree()")
f63e6d898760 ("powerpc/livepatch: Add livepatch header")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
--
Thanks
Sasha
Similar to commit 89c140bbaeee ("pseries: Fix 64 bit logical memory block panic")
make sure different variables tracking lmb_size are updated to be 64 bit.
This was found by code audit.
Cc: stable@vger.kernel.org
Signed-off-by: Aneesh Kumar K.V <redacted>
---
arch/powerpc/include/asm/drmem.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Hi
[This is an automated email]
This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.8.2, v5.7.16, v5.4.59, v4.19.140, v4.14.193, v4.9.232, v4.4.232.
v5.8.2: Build OK!
v5.7.16: Build OK!
v5.4.59: Build OK!
v4.19.140: Build OK!
v4.14.193: Failed to apply! Possible dependencies:
22508f3dc985 ("powerpc/numa: Look up device node in of_get_usable_memory()")
2c77721552e5 ("powerpc: Move of_drconf_cell struct to asm/drmem.h")
35f80debaef0 ("powerpc/numa: Look up device node in of_get_assoc_arrays()")
514a9cb3316a ("powerpc/numa: Update numa code use walk_drmem_lmbs")
6195a5001f1d ("powerpc/pseries: Update memory hotplug code to use drmem LMB array")
6c6ea53725b3 ("powerpc/mm: Separate ibm, dynamic-memory data from DT format")
b6eca183e23e ("powerpc/kernel: Enables memory hot-remove after reboot on pseries guests")
b88fc309d6ad ("powerpc/numa: Look up associativity array in of_drconf_to_nid_single")
v4.9.232: Failed to apply! Possible dependencies:
3a2df3798d4d ("powerpc/mm: Make switch_mm_irqs_off() out of line")
43ed84a891b7 ("powerpc/mm: Move pgdir setting into a helper")
5a61ef74f269 ("powerpc/64s: Support new device tree binding for discovering CPU features")
5d451a87e5eb ("powerpc/64: Retrieve number of L1 cache sets from device-tree")
6c6ea53725b3 ("powerpc/mm: Separate ibm, dynamic-memory data from DT format")
70cd4c10b290 ("KVM: PPC: Book3S HV: Fix software walk of guest process page tables")
9b081e10805c ("powerpc: port 64 bits pgtable_cache to 32 bits")
a25bd72badfa ("powerpc/mm/radix: Workaround prefetch issue with KVM")
bd067f83b084 ("powerpc/64: Fix naming of cache block vs. cache line")
dbcbfee0c81c ("powerpc/64: More definitions for POWER9")
e2827fe5c156 ("powerpc/64: Clean up ppc64_caches using a struct per cache")
f4329f2ecb14 ("powerpc/64s: Reduce exception alignment")
v4.4.232: Failed to apply! Possible dependencies:
11a6f6abd74a ("powerpc/mm: Move radix/hash common data structures to book3s64 headers")
26b6a3d9bb48 ("powerpc/mm: move pte headers to book3s directory")
3808a88985b4 ("powerpc: Move FW feature probing out of pseries probe()")
3dfcb315d81e ("powerpc/mm: make a separate copy for book3s")
5a61ef74f269 ("powerpc/64s: Support new device tree binding for discovering CPU features")
5d31a96e6c01 ("powerpc/livepatch: Add livepatch stack to struct thread_info")
6574ba950bbe ("powerpc/kernel: Convert cpu_has_feature() to returning bool")
6c6ea53725b3 ("powerpc/mm: Separate ibm, dynamic-memory data from DT format")
a141cca3892b ("powerpc/mm: Add early_[cpu|mmu]_has_feature()")
a8ed87c92adf ("powerpc/mm/radix: Add MMU_FTR_RADIX")
b92a226e5284 ("powerpc: Move cpu_has_feature() to a separate file")
da6a97bf12d5 ("powerpc: Move epapr_paravirt_early_init() to early_init_devtree()")
f63e6d898760 ("powerpc/livepatch: Add livepatch header")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
--
Thanks
Sasha