diff options
author | Balbir Singh <bsingharora@gmail.com> | 2016-08-10 12:07:50 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-08-17 13:27:55 +1000 |
commit | 5c4bfc63a0e6ae9d3bb6f6e1bfaa9443c847998a (patch) | |
tree | b4c8bf2094f65733d57ad0c2e104a0b5441dab37 /core/console.c | |
parent | 683c50e27319d432176931bebb5aa172606783ac (diff) | |
download | skiboot-5c4bfc63a0e6ae9d3bb6f6e1bfaa9443c847998a.zip skiboot-5c4bfc63a0e6ae9d3bb6f6e1bfaa9443c847998a.tar.gz skiboot-5c4bfc63a0e6ae9d3bb6f6e1bfaa9443c847998a.tar.bz2 |
Use additional checks in skiboot for pointers
The checks validate pointers sent in using
opal_addr_valid() in opal_call API's provided
via the console, cpu, fdt, flash, i2c, interrupts,
nvram, opal-msg, opal, opal-pci, xscom and
cec modules
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/console.c')
-rw-r--r-- | core/console.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/console.c b/core/console.c index 730ac24..1bdb0a7 100644 --- a/core/console.c +++ b/core/console.c @@ -338,6 +338,10 @@ static int64_t dummy_console_write(int64_t term_number, int64_t *length, { if (term_number != 0) return OPAL_PARAMETER; + + if (!opal_addr_valid(length) || !opal_addr_valid(buffer)) + return OPAL_PARAMETER; + write(0, buffer, *length); return OPAL_SUCCESS; @@ -349,6 +353,10 @@ static int64_t dummy_console_write_buffer_space(int64_t term_number, { if (term_number != 0) return OPAL_PARAMETER; + + if (!opal_addr_valid(length)) + return OPAL_PARAMETER; + if (length) *length = INMEM_CON_OUT_LEN; @@ -361,6 +369,10 @@ static int64_t dummy_console_read(int64_t term_number, int64_t *length, { if (term_number != 0) return OPAL_PARAMETER; + + if (!opal_addr_valid(length) || !opal_addr_valid(buffer)) + return OPAL_PARAMETER; + *length = read(0, buffer, *length); opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT, 0); |