Skip to content

Commit 6c53cbf

Browse files
author
Borislav Petkov
committed
x86, microcode: Correct sysdev_add error path
When we encounter an error while initting the microcode driver on a CPU, we must undo the previously added sysfs group. Cc: Tigran Aivazian <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Andreas Herrmann <[email protected]>
1 parent 100b33c commit 6c53cbf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/kernel/microcode_core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,10 @@ static int mc_sysdev_add(struct sys_device *sys_dev)
417417
if (err)
418418
return err;
419419

420-
if (microcode_init_cpu(cpu) == UCODE_ERROR)
421-
err = -EINVAL;
420+
if (microcode_init_cpu(cpu) == UCODE_ERROR) {
421+
sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
422+
return -EINVAL;
423+
}
422424

423425
return err;
424426
}

0 commit comments

Comments
 (0)