X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=mm%2Fmmap.c;h=fa5cb89348bad2b034e3f2f9d82cac8e06390018;hb=089c13477b5bed0c83ebb4e7092f254b70df080d;hp=9aa554b7e620e1c0596a45035fbf0ebc3372dd0e;hpb=c98536343efee5087773751d2a26899ed302acf3;p=firefly-linux-kernel-4.4.55.git diff --git a/mm/mmap.c b/mm/mmap.c index 9aa554b7e620..fa5cb89348ba 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2063,14 +2063,17 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns { struct mm_struct *mm = vma->vm_mm; struct rlimit *rlim = current->signal->rlim; - unsigned long new_start; + unsigned long new_start, actual_size; /* address space limit tests */ if (!may_expand_vm(mm, grow)) return -ENOMEM; /* Stack limit test */ - if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur)) + actual_size = size; + if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN))) + actual_size -= PAGE_SIZE; + if (actual_size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur)) return -ENOMEM; /* mlock limit tests */ @@ -2571,6 +2574,16 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len) detach_vmas_to_be_unmapped(mm, vma, prev, end); unmap_region(mm, vma, prev, start, end); +#ifdef CONFIG_ARCH_ROCKCHIP + { + extern int ion_munmap(void *dmabuf, struct vm_area_struct *vma); + extern int dma_buf_is_dma_buf(struct file *file); + if (vma->vm_file && dma_buf_is_dma_buf(vma->vm_file)) { + ion_munmap(vma->vm_file->private_data, vma); + } + } +#endif + /* Fix up all other VM information */ remove_vma_list(mm, vma);