Skip to content

Commit 37b972b

Browse files
prime-zenggregkh
authored andcommitted
cpu-topology: Fix the potential data corruption
[ Upstream commit 4a33691 ] 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 <sudeep.holla@arm.com> Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com> Link: https://lore.kernel.org/r/1583294092-5929-1-git-send-email-prime.zeng@hisilicon.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2d4e6ce commit 37b972b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/base/arch_topology.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static int __init get_cpu_for_node(struct device_node *node)
270270
static int __init parse_core(struct device_node *core, int package_id,
271271
int core_id)
272272
{
273-
char name[10];
273+
char name[20];
274274
bool leaf = true;
275275
int i = 0;
276276
int cpu;
@@ -317,7 +317,7 @@ static int __init parse_core(struct device_node *core, int package_id,
317317

318318
static int __init parse_cluster(struct device_node *cluster, int depth)
319319
{
320-
char name[10];
320+
char name[20];
321321
bool leaf = true;
322322
bool has_cores = false;
323323
struct device_node *c;

0 commit comments

Comments
 (0)