From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: [PATCH 1/4] cgroup: fix error return value in cgroup_mount() Date: Tue, 28 Jan 2014 10:32:02 -0500 Message-ID: <1390923125-4369-2-git-send-email-tj@kernel.org> References: <1390923125-4369-1-git-send-email-tj@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=uXsRQApCMy5k77CMbtNtV3CoK4hy/okzUve3+wQad20=; b=Fp8WG3nrs+MqqcP0AnzcgIYqGIbLJehw00zJVe2aCX3YbLyouRpB25SafwY3CbKKOm kO9bLpcw6adcWWnkzgi7GAXlsaaIbx3Tq0qkmDmt5UzPRmBUcsCjqiYTlKNH+XemWn94 quthhdWd16q3AREssRSvjsvZh3G0tFUPgpwLbJArKeqd5yzEbNJO1WjIoTTmiUhGNknA XrcMn1Rs3XDxMZA/0obju0vmce3uFCE45R414VMJQTAMT5iUV07MF0QjC97sv1xc1OPA 4Y3dmQdSvPPIji54VzXfT8v3RibinB7HE5mkjs+jCn8wiTssU/3B5s+I25qIJueuYDwA Objg== In-Reply-To: <1390923125-4369-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org Cc: Tejun Heo , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org When cgroup_mount() fails to allocate an id for the root, it didn't set ret before jumping to unlock_drop ending up returning 0 after a failure. Fix it. Signed-off-by: Tejun Heo Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org --- kernel/cgroup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c index e2f46ba..364aeb22 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -1566,10 +1566,10 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, mutex_lock(&cgroup_mutex); mutex_lock(&cgroup_root_mutex); - root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp, - 0, 1, GFP_KERNEL); - if (root_cgrp->id < 0) + ret = idr_alloc(&root->cgroup_idr, root_cgrp, 0, 1, GFP_KERNEL); + if (ret < 0) goto unlock_drop; + root_cgrp->id = ret; /* Check for name clashes with existing mounts */ ret = -EBUSY; -- 1.8.5.3