Skip to content

Commit 4a33691

Browse files
prime-zenggregkh
authored andcommitted
cpu-topology: Fix the potential data corruption
Currently there are only 10 bytes to store the cpu-topology 'name' information. Only 10 bytes copied into cluster/thread/core names. If the cluster ID exceeds 2-digit number, it will result in the data corruption, and ending up in a dead loop in the parsing routines. The same applies to the thread names with more that 3-digit number. This issue was found using the boundary tests under virtualised environment like QEMU. Let us increase the buffer to fix such potential issues. Reviewed-by: Sudeep Holla <[email protected]> Signed-off-by: Zeng Tao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b8fe128 commit 4a33691

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/base/arch_topology.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static int __init get_cpu_for_node(struct device_node *node)
297297
static int __init parse_core(struct device_node *core, int package_id,
298298
int core_id)
299299
{
300-
char name[10];
300+
char name[20];
301301
bool leaf = true;
302302
int i = 0;
303303
int cpu;
@@ -343,7 +343,7 @@ static int __init parse_core(struct device_node *core, int package_id,
343343

344344
static int __init parse_cluster(struct device_node *cluster, int depth)
345345
{
346-
char name[10];
346+
char name[20];
347347
bool leaf = true;
348348
bool has_cores = false;
349349
struct device_node *c;

0 commit comments

Comments
 (0)