mirror of
https://github.com/adulau/aha.git
synced 2024-12-26 18:56:14 +00:00
cgroup: catch bad css refcnt at css_put
__css_put() doesn't check a bug as refcnt goes to minus. I think it should be caught. This patch adds a check for it. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Paul Menage <menage@google.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
26251eaf98
commit
3dece8347d
1 changed files with 4 additions and 1 deletions
|
@ -3708,8 +3708,10 @@ static void check_for_release(struct cgroup *cgrp)
|
|||
void __css_put(struct cgroup_subsys_state *css)
|
||||
{
|
||||
struct cgroup *cgrp = css->cgroup;
|
||||
int val;
|
||||
rcu_read_lock();
|
||||
if (atomic_dec_return(&css->refcnt) == 1) {
|
||||
val = atomic_dec_return(&css->refcnt);
|
||||
if (val == 1) {
|
||||
if (notify_on_release(cgrp)) {
|
||||
set_bit(CGRP_RELEASABLE, &cgrp->flags);
|
||||
check_for_release(cgrp);
|
||||
|
@ -3717,6 +3719,7 @@ void __css_put(struct cgroup_subsys_state *css)
|
|||
cgroup_wakeup_rmdir_waiter(cgrp);
|
||||
}
|
||||
rcu_read_unlock();
|
||||
WARN_ON_ONCE(val < 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue