|
@@ -2336,6 +2336,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);
|