diff options
author | Helge Deller <deller@gmx.de> | 2017-07-25 18:20:54 +0200 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2017-07-25 18:24:39 +0200 |
commit | f520e55241e1cf0c10d308ccf47513f28533f60a (patch) | |
tree | fa785945c28ff2e0d3c777d2f4a59fdf92756716 /arch/parisc/kernel/pdt.c | |
parent | parisc: regenerate defconfig files (diff) | |
download | linux-f520e55241e1cf0c10d308ccf47513f28533f60a.tar.xz linux-f520e55241e1cf0c10d308ccf47513f28533f60a.zip |
parisc: Fix crash when calling PDC_PAT_MEM PDT firmware function
Commit c9c2877d08d9 ("parisc: Add Page Deallocation Table (PDT) support")
introduced the pdc_pat_mem_read_pd_pdt() firmware helper function, which
crashed the system because it trashed the stack if the
pdc_pat_mem_read_pd_retinfo struct was located on the stack (and which is
in size less than the required 32 64-bit values).
Fix it by using the pdc_result struct instead when calling firmware and copy
the return values back into the result struct when finished sucessfully.
While debugging this code I noticed that the pdc_type wasn't set correctly
either, so let's fix that too.
Fixes: c9c2877d08d9 ("parisc: Add Page Deallocation Table (PDT) support")
Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc/kernel/pdt.c')
-rw-r--r-- | arch/parisc/kernel/pdt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/parisc/kernel/pdt.c b/arch/parisc/kernel/pdt.c index f3a797e670b0..040d49b723d7 100644 --- a/arch/parisc/kernel/pdt.c +++ b/arch/parisc/kernel/pdt.c @@ -112,10 +112,12 @@ void __init pdc_pdt_init(void) #ifdef CONFIG_64BIT struct pdc_pat_mem_read_pd_retinfo pat_pret; + /* try old obsolete PAT firmware function first */ + pdt_type = PDT_PAT_OLD; ret = pdc_pat_mem_read_cell_pdt(&pat_pret, pdt_entry, MAX_PDT_ENTRIES); if (ret != PDC_OK) { - pdt_type = PDT_PAT_OLD; + pdt_type = PDT_PAT_NEW; ret = pdc_pat_mem_read_pd_pdt(&pat_pret, pdt_entry, MAX_PDT_TABLE_SIZE, 0); } |