]> git.karo-electronics.de Git - linux-beck.git/commit
cxl: Fix DAR check & use REGION_ID instead of opencoding
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Wed, 20 Apr 2016 07:59:47 +0000 (03:59 -0400)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 26 Apr 2016 11:06:36 +0000 (21:06 +1000)
commit3b1dbfa14f97188ec33fdfc7acb66bea59a3bb21
treeaed4c2b33cd4e481238d6cfa2a2dbe4446cf50d6
parent4aec6ec0da9c72c0fa1a5b0d1133707481347bb3
cxl: Fix DAR check & use REGION_ID instead of opencoding

The current code will set _PAGE_USER to the access flags for any
fault address, because the ~ operation will be true for all address we
take a fault on. But setting _PAGE_USER also means that the fault will
be handled only if the page table have _PAGE_USER set. Hence there is
no security hole with the current code.

Now if it is an user space access, then the change in this patch really
don't have an impact because we have (!ctx->kernel) set true
and we take the if condition true.

Now kernel context created fault on an address in the kernel range
will result in a fault loop because we will not insert the
hash pte due to access and pte permission mismatch. This patch fix
the above issue.

Fixes: f204e0b8cedd ("cxl: Driver code for powernv PCIe based cards for userspace access")
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
drivers/misc/cxl/fault.c