1bd098903fda069cb96fe8b5cb4595b46c683385 |
|
07-Jun-2014 |
Anton Blanchard <anton@samba.org> |
powernv: Fix permissions on sysparam sysfs entries Everyone can write to these files, which is not what we want. Cc: stable@vger.kernel.org # 3.15 Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
63aecfb20a6629f1ca91d7a052f87988ceb6dd53 |
|
24-Apr-2014 |
Joel Stanley <joel@jms.id.au> |
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>
|
16003d235bdb4d1ebcecfe4915c6e6d8c95f4a0c |
|
24-Apr-2014 |
Joel Stanley <joel@jms.id.au> |
powerpc/powernv: Fix typos in sysparam code Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
85390378f0a6abf3bdb10c3d504d77862a2d0ec9 |
|
24-Apr-2014 |
Joel Stanley <joel@jms.id.au> |
powerpc/powernv: Check sysfs size before copying The sysparam code currently uses the userspace supplied number of bytes when memcpy()ing in to a local 64-byte buffer. Limit the maximum number of bytes by the size of the buffer. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
b8569d230416c490065098684adf13c1751cb830 |
|
24-Apr-2014 |
Joel Stanley <joel@jms.id.au> |
powerpc/powernv: Use ssize_t for sysparam return values The OPAL calls are returning int64_t values, which the sysparam code stores in an int, and the sysfs callback returns ssize_t. Make code a easier to read by consistently using ssize_t. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
ba9a32b176c31ec4d3d7314bb2e529a85423f7a4 |
|
24-Apr-2014 |
Joel Stanley <joel@jms.id.au> |
powerpc/powernv: Fix sysparam sysfs error handling When a sysparam query in OPAL returned a negative value (error code), sysfs would spew out a decent chunk of memory; almost 64K more than expected. This was traced to a sign/unsigned mix up in the OPAL sysparam sysfs code at sys_param_show. The return value of sys_param_show is a ssize_t, calculated using return ret ? ret : attr->param_size; Alan Modra explains: "attr->param_size" is an unsigned int, "ret" an int, so the overall expression has type unsigned int. Result is that ret is cast to unsigned int before being cast to ssize_t. Instead of using the ternary operator, set ret to the param_size if an error is not detected. The same bug exists in the sysfs write callback; this patch fixes it in the same way. A note on debugging this next time: on my system gcc will warn about this if compiled with -Wsign-compare, which is not enabled by -Wall, only -Wextra. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
bb4398e1de739a13e06589fc04cbb2267ba59800 |
|
28-Mar-2014 |
Anton Blanchard <anton@samba.org> |
powerpc/powernv: Fix endian issues with OPAL async code OPAL defines opal_msg as a big endian struct so we have to byte swap it on little endian builds. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
4029cd66545f0a45258eda5313b7559bfeaaaae4 |
|
07-Mar-2014 |
Neelesh Gupta <neelegup@linux.vnet.ibm.com> |
powerpc/powernv: Enable reading and updating of system parameters This patch enables reading and updating of system parameters through OPAL call. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|