Home
last modified time | relevance | path

Searched hist:"1856 f50c66dff0afb4a6a3e22497ae153aec9411" (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/arch/powerpc/kernel/
H A Dprom.cdiff 1856f50c66dff0afb4a6a3e22497ae153aec9411 Fri Oct 16 16:38:45 CDT 2015 Christophe Jaillet <christophe.jaillet@wanadoo.fr> powerpc/prom: Avoid reference to potentially freed memory

of_get_property() is used inside the loop, but then the reference to the
node is dropped before dereferencing the prop pointer, which could by then
point to junk if the node has been freed.

Instead use of_property_read_u32() to actually read the property
value before dropping the reference.

of_property_read_u32() requires at least one cell (u32) to be present,
which is stricter than the old logic which would happily dereference a
property of any size. However we believe all device trees in the wild
have at least one cell.

Skiboot may produce memory nodes with more than one cell, but that is
OK, of_property_read_u32() will return the first one.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
[mpe: Expand change log with device tree details]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>