summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-01-07 17:20:53 -0800
committerColin Cross <ccross@android.com>2011-01-07 17:20:53 -0800
commit351516118103c6c7bb5321aa9d5866eb3dc0d5ca (patch)
treebf8ecc55d77847ec8299bcf964352bef38121cc5 /mm
parentc37bff78783d40d6e604129135c207e279de902f (diff)
parentbd842b53fada517017d192c8a12fc9a38e6250e1 (diff)
Merge branch 'linux-tegra-2.6.36' into android-tegra-2.6.36
Conflicts: arch/arm/mm/cache-v6.S Change-Id: I1a2063218dd705a762a40f4a9dfe504ce1a1d491
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c19
-rw-r--r--mm/mmap.c16
2 files changed, 21 insertions, 14 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e6aadd65a71a..0f900de4c676 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1730,19 +1730,18 @@ again:
rcu_read_lock();
p = rcu_dereference(mm->owner);
- VM_BUG_ON(!p);
/*
- * because we don't have task_lock(), "p" can exit while
- * we're here. In that case, "mem" can point to root
- * cgroup but never be NULL. (and task_struct itself is freed
- * by RCU, cgroup itself is RCU safe.) Then, we have small
- * risk here to get wrong cgroup. But such kind of mis-account
- * by race always happens because we don't have cgroup_mutex().
- * It's overkill and we allow that small race, here.
+ * Because we don't have task_lock(), "p" can exit.
+ * In that case, "mem" can point to root or p can be NULL with
+ * race with swapoff. Then, we have small risk of mis-accouning.
+ * But such kind of mis-account by race always happens because
+ * we don't have cgroup_mutex(). It's overkill and we allo that
+ * small race, here.
+ * (*) swapoff at el will charge against mm-struct not against
+ * task-struct. So, mm->owner can be NULL.
*/
mem = mem_cgroup_from_task(p);
- VM_BUG_ON(!mem);
- if (mem_cgroup_is_root(mem)) {
+ if (!mem || mem_cgroup_is_root(mem)) {
rcu_read_unlock();
goto done;
}
diff --git a/mm/mmap.c b/mm/mmap.c
index 00161a48a451..283a0a84ea2c 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2460,6 +2460,7 @@ int install_special_mapping(struct mm_struct *mm,
unsigned long addr, unsigned long len,
unsigned long vm_flags, struct page **pages)
{
+ int ret;
struct vm_area_struct *vma;
vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
@@ -2477,16 +2478,23 @@ int install_special_mapping(struct mm_struct *mm,
vma->vm_ops = &special_mapping_vmops;
vma->vm_private_data = pages;
- if (unlikely(insert_vm_struct(mm, vma))) {
- kmem_cache_free(vm_area_cachep, vma);
- return -ENOMEM;
- }
+ ret = security_file_mmap(NULL, 0, 0, 0, vma->vm_start, 1);
+ if (ret)
+ goto out;
+
+ ret = insert_vm_struct(mm, vma);
+ if (ret)
+ goto out;
mm->total_vm += len >> PAGE_SHIFT;
perf_event_mmap(vma);
return 0;
+
+out:
+ kmem_cache_free(vm_area_cachep, vma);
+ return ret;
}
static DEFINE_MUTEX(mm_all_locks_mutex);