@@ -882,7 +882,7 @@ static int mpx_unmap_tables(struct mm_struct *mm,
* necessary, and the 'vma' is the first vma in this range (start -> end).
*/
void mpx_notify_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
- unsigned long start, unsigned long end)
+ unsigned long start, unsigned long end)
{
int ret;
@@ -890,7 +890,7 @@ void mpx_notify_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
* Refuse to do anything unless userspace has asked
* the kernel to help manage the bounds tables,
*/
- if (!kernel_managing_mpx_tables(current->mm))
+ if (!kernel_managing_mpx_tables(mm))
return;
/*
* This will look across the entire 'start -> end' range,
If @mm is not the same as current->mm, mpx_notify_unmap() will yield invalid results and at worst will lead to a crash if it gets called by a kthread. The function in question gets called through do_munmap(). ATM kernel does not use that function on x86 in such context that mm and current->mm would differ With the addition of SGX driver code, do_munmap() is called from workqueue thread. This commit changes the parameter passed to @mm so that this will yield the correct results and not crash as reference to current->mm would be NULL in a kthread context. Cc: Dave Hansen <dave.hansen@intel.com> Fixes: 1de4fa14ee25 ("x86, mpx: Cleanup unused bound tables") Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> --- arch/x86/mm/mpx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)