Commit 237d6e68 authored by Michael Holzheu's avatar Michael Holzheu Committed by Martin Schwidefsky

s390/hypfs: Use get_free_page() instead of kmalloc to ensure page alignment

Since commit d86bd1be ("mm/slub: support left redzone") it is no longer
guaranteed that kmalloc(PAGE_SIZE) returns page aligned memory.

After the above commit we get an error for diag224 because aligned
memory is required. This leads to the following user visible error:

 # mount none -t s390_hypfs /sys/hypervisor/
 mount: unknown filesystem type 's390_hypfs'

 # dmesg | grep hypfs
 hypfs.cccfb8: The hardware system does not provide all functions
               required by hypfs
 hypfs.7a79f0: Initialization of hypfs failed with rc=-61

Fix this problem and use get_free_page() instead of kmalloc() to get
correctly aligned memory.

Cc: stable@vger.kernel.org # v3.6+
Signed-off-by: default avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 14970f20
...@@ -363,11 +363,11 @@ static void *diag204_store(void) ...@@ -363,11 +363,11 @@ static void *diag204_store(void)
static int diag224_get_name_table(void) static int diag224_get_name_table(void)
{ {
/* memory must be below 2GB */ /* memory must be below 2GB */
diag224_cpu_names = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); diag224_cpu_names = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
if (!diag224_cpu_names) if (!diag224_cpu_names)
return -ENOMEM; return -ENOMEM;
if (diag224(diag224_cpu_names)) { if (diag224(diag224_cpu_names)) {
kfree(diag224_cpu_names); free_page((unsigned long) diag224_cpu_names);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16); EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16);
...@@ -376,7 +376,7 @@ static int diag224_get_name_table(void) ...@@ -376,7 +376,7 @@ static int diag224_get_name_table(void)
static void diag224_delete_name_table(void) static void diag224_delete_name_table(void)
{ {
kfree(diag224_cpu_names); free_page((unsigned long) diag224_cpu_names);
} }
static int diag224_idx2name(int index, char *name) static int diag224_idx2name(int index, char *name)
......
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