diff options
-rw-r--r-- | kernel/cgroup.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 580d3484f97a..8afddb1a1c6c 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2583,6 +2583,10 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, | |||
2583 | kernfs_break_active_protection(of->kn); | 2583 | kernfs_break_active_protection(of->kn); |
2584 | 2584 | ||
2585 | mutex_lock(&cgroup_tree_mutex); | 2585 | mutex_lock(&cgroup_tree_mutex); |
2586 | if (!cgroup_lock_live_group(cgrp)) { | ||
2587 | ret = -ENODEV; | ||
2588 | goto out_unlock_tree; | ||
2589 | } | ||
2586 | 2590 | ||
2587 | for_each_subsys(ss, ssid) { | 2591 | for_each_subsys(ss, ssid) { |
2588 | if (enable & (1 << ssid)) { | 2592 | if (enable & (1 << ssid)) { |
@@ -2606,6 +2610,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, | |||
2606 | cgroup_get(child); | 2610 | cgroup_get(child); |
2607 | prepare_to_wait(&child->offline_waitq, &wait, | 2611 | prepare_to_wait(&child->offline_waitq, &wait, |
2608 | TASK_UNINTERRUPTIBLE); | 2612 | TASK_UNINTERRUPTIBLE); |
2613 | mutex_unlock(&cgroup_mutex); | ||
2609 | mutex_unlock(&cgroup_tree_mutex); | 2614 | mutex_unlock(&cgroup_tree_mutex); |
2610 | schedule(); | 2615 | schedule(); |
2611 | finish_wait(&child->offline_waitq, &wait); | 2616 | finish_wait(&child->offline_waitq, &wait); |
@@ -2620,7 +2625,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, | |||
2620 | (cgrp->parent && | 2625 | (cgrp->parent && |
2621 | !(cgrp->parent->child_subsys_mask & (1 << ssid)))) { | 2626 | !(cgrp->parent->child_subsys_mask & (1 << ssid)))) { |
2622 | ret = -ENOENT; | 2627 | ret = -ENOENT; |
2623 | goto out_unlock_tree; | 2628 | goto out_unlock; |
2624 | } | 2629 | } |
2625 | } else if (disable & (1 << ssid)) { | 2630 | } else if (disable & (1 << ssid)) { |
2626 | if (!(cgrp->child_subsys_mask & (1 << ssid))) { | 2631 | if (!(cgrp->child_subsys_mask & (1 << ssid))) { |
@@ -2632,7 +2637,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, | |||
2632 | cgroup_for_each_live_child(child, cgrp) { | 2637 | cgroup_for_each_live_child(child, cgrp) { |
2633 | if (child->child_subsys_mask & (1 << ssid)) { | 2638 | if (child->child_subsys_mask & (1 << ssid)) { |
2634 | ret = -EBUSY; | 2639 | ret = -EBUSY; |
2635 | goto out_unlock_tree; | 2640 | goto out_unlock; |
2636 | } | 2641 | } |
2637 | } | 2642 | } |
2638 | } | 2643 | } |
@@ -2640,12 +2645,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of, | |||
2640 | 2645 | ||
2641 | if (!enable && !disable) { | 2646 | if (!enable && !disable) { |
2642 | ret = 0; | 2647 | ret = 0; |
2643 | goto out_unlock_tree; | 2648 | goto out_unlock; |
2644 | } | ||
2645 | |||
2646 | if (!cgroup_lock_live_group(cgrp)) { | ||
2647 | ret = -ENODEV; | ||
2648 | goto out_unlock_tree; | ||
2649 | } | 2649 | } |
2650 | 2650 | ||
2651 | /* | 2651 | /* |