| .. | .. |
|---|
| 22 | 22 | unsigned int op) |
|---|
| 23 | 23 | { |
|---|
| 24 | 24 | struct vm_area_struct *vma; |
|---|
| 25 | + struct mm_struct *mm = current->mm; |
|---|
| 25 | 26 | |
|---|
| 26 | 27 | if (len == 0) |
|---|
| 27 | 28 | return 0; |
|---|
| .. | .. |
|---|
| 34 | 35 | if (addr + len < addr) |
|---|
| 35 | 36 | return -EFAULT; |
|---|
| 36 | 37 | |
|---|
| 38 | + if (mmap_read_lock_killable(mm)) |
|---|
| 39 | + return -EINTR; |
|---|
| 40 | + |
|---|
| 37 | 41 | /* |
|---|
| 38 | 42 | * Verify that the specified address region actually belongs |
|---|
| 39 | 43 | * to this process. |
|---|
| 40 | 44 | */ |
|---|
| 41 | | - vma = find_vma(current->mm, addr); |
|---|
| 42 | | - if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) |
|---|
| 45 | + vma = find_vma(mm, addr); |
|---|
| 46 | + if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) { |
|---|
| 47 | + mmap_read_unlock(mm); |
|---|
| 43 | 48 | return -EFAULT; |
|---|
| 49 | + } |
|---|
| 44 | 50 | |
|---|
| 45 | 51 | flush_cache_range(vma, addr, addr + len); |
|---|
| 46 | 52 | |
|---|
| 53 | + mmap_read_unlock(mm); |
|---|
| 47 | 54 | return 0; |
|---|
| 48 | 55 | } |
|---|
| 49 | 56 | |
|---|