Commit c0f07ff9 authored by Martin Schwidefsky's avatar Martin Schwidefsky

s390/monwriter: do not use stack buffers for hardware data

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

Use kmalloc to get memory for the appldata_parameter_list and
appldata_product_id structures.
Reviewed-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 8ef9eda0
...@@ -58,24 +58,31 @@ struct mon_private { ...@@ -58,24 +58,31 @@ struct mon_private {
static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn) static int monwrite_diag(struct monwrite_hdr *myhdr, char *buffer, int fcn)
{ {
struct appldata_parameter_list parm_list; struct appldata_parameter_list *parm_list;
struct appldata_product_id id; struct appldata_product_id *id;
int rc; int rc;
memcpy(id.prod_nr, "LNXAPPL", 7); id = kmalloc(sizeof(*id), GFP_KERNEL);
id.prod_fn = myhdr->applid; parm_list = kmalloc(sizeof(*parm_list), GFP_KERNEL);
id.record_nr = myhdr->record_num; rc = -ENOMEM;
id.version_nr = myhdr->version; if (!id || !parm_list)
id.release_nr = myhdr->release; goto out;
id.mod_lvl = myhdr->mod_level; memcpy(id->prod_nr, "LNXAPPL", 7);
rc = appldata_asm(&parm_list, &id, fcn, id->prod_fn = myhdr->applid;
id->record_nr = myhdr->record_num;
id->version_nr = myhdr->version;
id->release_nr = myhdr->release;
id->mod_lvl = myhdr->mod_level;
rc = appldata_asm(parm_list, id, fcn,
(void *) buffer, myhdr->datalen); (void *) buffer, myhdr->datalen);
if (rc <= 0) if (rc <= 0)
return rc; goto out;
pr_err("Writing monitor data failed with rc=%i\n", rc); pr_err("Writing monitor data failed with rc=%i\n", rc);
if (rc == 5) rc = (rc == 5) ? -EPERM : -EINVAL;
return -EPERM; out:
return -EINVAL; kfree(id);
kfree(parm_list);
return rc;
} }
static struct mon_buf *monwrite_find_hdr(struct mon_private *monpriv, static struct mon_buf *monwrite_find_hdr(struct mon_private *monpriv,
......
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