summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/diag288_wdt.c
diff options
context:
space:
mode:
authorAlexander Egorenkov <egorenar@linux.ibm.com>2023-01-27 14:52:41 +0100
committerHeiko Carstens <hca@linux.ibm.com>2023-01-30 14:40:50 +0100
commitfe8973a3ad0905cb9ba2d42db42ed51de14737df (patch)
tree3b8f426c009305ce6f182eef56bb32ba4ab609bb /drivers/watchdog/diag288_wdt.c
parent41e1992665a2701fa025a8b76970c43b4148446f (diff)
downloadlinux-fe8973a3ad0905cb9ba2d42db42ed51de14737df.tar.gz
linux-fe8973a3ad0905cb9ba2d42db42ed51de14737df.tar.bz2
linux-fe8973a3ad0905cb9ba2d42db42ed51de14737df.zip
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: Alexander Egorenkov <egorenar@linux.ibm.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Cc: <stable@vger.kernel.org> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'drivers/watchdog/diag288_wdt.c')
-rw-r--r--drivers/watchdog/diag288_wdt.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c
index 4cb10877017c..2112eef69969 100644
--- a/drivers/watchdog/diag288_wdt.c
+++ b/drivers/watchdog/diag288_wdt.c
@@ -268,12 +268,21 @@ static int __init diag288_init(void)
char ebc_begin[] = {
194, 197, 199, 201, 213
};
+ char *ebc_cmd;
watchdog_set_nowayout(&wdt_dev, nowayout_info);
if (MACHINE_IS_VM) {
- if (__diag288_vm(WDT_FUNC_INIT, 15,
- ebc_begin, sizeof(ebc_begin)) != 0) {
+ ebc_cmd = kmalloc(sizeof(ebc_begin), GFP_KERNEL);
+ 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");
return -EINVAL;
}