Skip to content

Commit

Permalink
vcsm: Treat EBUSY as success rather than SIGBUS
Browse files Browse the repository at this point in the history
Currently if two cores access the same page concurrently one will return VM_FAULT_NOPAGE
and the other VM_FAULT_SIGBUS crashing the user code.

Also report when mapping fails.

Signed-off-by: popcornmix <popcornmix@gmail.com>
  • Loading branch information
popcornmix committed May 4, 2017
1 parent e1b1d82 commit 5684284
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/char/broadcom/vc_sm/vmcs_sm.c
Expand Up @@ -1181,11 +1181,20 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
switch (ret) {
case 0:
case -ERESTARTSYS:
/*
* EBUSY is ok: this just means that another thread
* already did the job.
*/
case -EBUSY:
return VM_FAULT_NOPAGE;
case -ENOMEM:
case -EAGAIN:
pr_err("[%s]: failed to map page pfn:%lx virt:%lx ret:%d\n", __func__,
pfn, (unsigned long)vmf->virtual_address, ret);
return VM_FAULT_OOM;
default:
pr_err("[%s]: failed to map page pfn:%lx virt:%lx ret:%d\n", __func__,
pfn, (unsigned long)vmf->virtual_address, ret);
return VM_FAULT_SIGBUS;
}
}
Expand Down

0 comments on commit 5684284

Please sign in to comment.