Skip to content

Commit b003112

Browse files
author
Mamatha Inamdar
committed
powerpc/powernv: Add a null pointer check to scom_debug_init_one()
JIRA: https://issues.redhat.com/browse/RHEL-37052 CVE: CVE-2023-52690 commit 9a260f2 Author: Kunwu Chan <chentao@kylinos.cn> Date: Fri Dec 8 16:59:37 2023 +0800 powerpc/powernv: Add a null pointer check to scom_debug_init_one() kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Add a null pointer check, and release 'ent' to avoid memory leaks. Fixes: bfd2f0d ("powerpc/powernv: Get rid of old scom_controller abstraction") Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20231208085937.107210-1-chentao@kylinos.cn Signed-off-by: Mamatha Inamdar <minamdar@redhat.com>
1 parent ab62de2 commit b003112

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/powerpc/platforms/powernv/opal-xscom.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn,
165165
ent->chip = chip;
166166
snprintf(ent->name, 16, "%08x", chip);
167167
ent->path.data = (void *)kasprintf(GFP_KERNEL, "%pOF", dn);
168+
if (!ent->path.data) {
169+
kfree(ent);
170+
return -ENOMEM;
171+
}
172+
168173
ent->path.size = strlen((char *)ent->path.data);
169174

170175
dir = debugfs_create_dir(ent->name, root);

0 commit comments

Comments
 (0)