Commit fe8973a3 authored by Alexander Egorenkov's avatar Alexander Egorenkov Committed by Heiko Carstens

watchdog: diag288_wdt: do not use stack buffers for hardware data

With CONFIG_VMAP_STACK=y the stack is allocated from the vmalloc space.
Data passed to a hardware or a hypervisor interface that
requires V=R can no longer be allocated on the stack.

Use kmalloc() to get memory for a diag288 command.
Signed-off-by: default avatarAlexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 41e19926
...@@ -268,12 +268,21 @@ static int __init diag288_init(void) ...@@ -268,12 +268,21 @@ static int __init diag288_init(void)
char ebc_begin[] = { char ebc_begin[] = {
194, 197, 199, 201, 213 194, 197, 199, 201, 213
}; };
char *ebc_cmd;
watchdog_set_nowayout(&wdt_dev, nowayout_info); watchdog_set_nowayout(&wdt_dev, nowayout_info);
if (MACHINE_IS_VM) { if (MACHINE_IS_VM) {
if (__diag288_vm(WDT_FUNC_INIT, 15, ebc_cmd = kmalloc(sizeof(ebc_begin), GFP_KERNEL);
ebc_begin, sizeof(ebc_begin)) != 0) { if (!ebc_cmd) {
pr_err("The watchdog cannot be initialized\n");
return -ENOMEM;
}
memcpy(ebc_cmd, ebc_begin, sizeof(ebc_begin));
ret = __diag288_vm(WDT_FUNC_INIT, 15,
ebc_cmd, sizeof(ebc_begin));
kfree(ebc_cmd);
if (ret != 0) {
pr_err("The watchdog cannot be initialized\n"); pr_err("The watchdog cannot be initialized\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment