X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=mm%2Fmprotect.c;h=258197b76fb4142d01b81d7871fddbca80510114;hb=b1aabecd55931ee754f6a913969516b26a0e682e;hp=abe2694e13f497ea8ecaa443fa6d7d11a5edb084;hpb=22deb791f303a26c7181e640b2aab2a4536626c5;p=linux-2.6-block.git diff --git a/mm/mprotect.c b/mm/mprotect.c index abe2694e13f4..258197b76fb4 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -151,10 +151,11 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, /* * If we make a private mapping writable we increase our commit; * but (without finer accounting) cannot reduce our commit if we - * make it unwritable again. + * make it unwritable again. hugetlb mapping were accounted for + * even if read-only so there is no need to account for them here */ if (newflags & VM_WRITE) { - if (!(oldflags & (VM_ACCOUNT|VM_WRITE| + if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_HUGETLB| VM_SHARED|VM_NORESERVE))) { charged = nrpages; if (security_vm_enough_memory(charged))