From: Andrei Vagin <avagin@gmail.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
David Howells <dhowells@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org,
Andrei Vagin <avagin@gmail.com>
Subject: [PATCH vfs/for-next] cgroup: fix cgroup refcnt leak
Date: Thu, 27 Dec 2018 10:17:21 -0800 [thread overview]
Message-ID: <20181227181721.24488-1-avagin@gmail.com> (raw)
Currently, we get refcnt twice if a new root isn't created.
percpu_ref_tryget_live() is called and then cgroup_get() is called too.
Fixes: aea3f2676c83 ("kernfs, sysfs, cgroup, intel_rdt: Support fs_context")
Signed-off-by: Andrei Vagin <avagin@gmail.com>
---
kernel/cgroup/cgroup-v1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index d5ae888b8c57..5ae9b3db8bfd 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -1280,8 +1280,8 @@ int cgroup1_get_tree(struct fs_context *fc)
mutex_lock(&cgroup_mutex);
percpu_ref_reinit(&root->cgrp.self.refcnt);
mutex_unlock(&cgroup_mutex);
+ cgroup_get(&root->cgrp);
}
- cgroup_get(&root->cgrp);
/*
* If @pinned_sb, we're reusing an existing root and holding an
--
2.17.2
next reply other threads:[~2018-12-27 18:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-27 18:17 Andrei Vagin [this message]
2018-12-29 0:01 ` [PATCH vfs/for-next] cgroup: fix cgroup refcnt leak Andrei Vagin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181227181721.24488-1-avagin@gmail.com \
--to=avagin@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).