Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property()

In dlpar_parse_cc_property(), 'prop->name' is allocated by kstrdup().
kstrdup() may return NULL, so it should be checked and handle error.
And prop should be freed if 'prop->name' is NULL.

Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Gen Zhang and committed by
Michael Ellerman
efa9ace6 3e3ebed3

+4
+4
arch/powerpc/platforms/pseries/dlpar.c
··· 61 61 62 62 name = (char *)ccwa + be32_to_cpu(ccwa->name_offset); 63 63 prop->name = kstrdup(name, GFP_KERNEL); 64 + if (!prop->name) { 65 + dlpar_free_cc_property(prop); 66 + return NULL; 67 + } 64 68 65 69 prop->length = be32_to_cpu(ccwa->prop_length); 66 70 value = (char *)ccwa + be32_to_cpu(ccwa->prop_offset);