]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/powernv: Check sysparam size before creation
authorJoel Stanley <joel@jms.id.au>
Thu, 24 Apr 2014 07:25:37 +0000 (16:55 +0930)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 28 Apr 2014 03:08:49 +0000 (13:08 +1000)
commit25c3ca29f3a796c2986d5eda053bb2b5de066f24
tree1f4985bfd80fe769b9916b179ddbfb12ba919393
parent077935443abd05a0e215f0d2823af9b8c2e5d1e6
powerpc/powernv: Check sysparam size before creation

The size of the sysparam sysfs files is determined from the device tree
at boot. However the buffer is hard coded to 64 bytes. If we encounter a
parameter that is larger than 64, or miss-parse the device tree, the
buffer will overflow when reading or writing to the parameter.

Check it at discovery time, and if the parameter is too large, do not
create a sysfs entry for it.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/powernv/opal-sysparam.c