summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-09-27 10:34:19 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-09-27 10:34:19 -0300
commit1c29f4306f557ef5d9ed515ec8881f4d1735b058 (patch)
tree1359b9f8403af67e35bbbaae36e2b60c9bb3d2da /mm
parent5b465b045af3a649a89b8a5c5bfdece20ffc0345 (diff)
Linux-libre 4.7.5-gnupck-4.7.5-gnu
Diffstat (limited to 'mm')
-rw-r--r--mm/mempolicy.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 297d6854f..e68286121 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2334,6 +2334,23 @@ out:
return ret;
}
+/*
+ * Drop the (possibly final) reference to task->mempolicy. It needs to be
+ * dropped after task->mempolicy is set to NULL so that any allocation done as
+ * part of its kmem_cache_free(), such as by KASAN, doesn't reference a freed
+ * policy.
+ */
+void mpol_put_task_policy(struct task_struct *task)
+{
+ struct mempolicy *pol;
+
+ task_lock(task);
+ pol = task->mempolicy;
+ task->mempolicy = NULL;
+ task_unlock(task);
+ mpol_put(pol);
+}
+
static void sp_delete(struct shared_policy *sp, struct sp_node *n)
{
pr_debug("deleting %lx-l%lx\n", n->start, n->end);