Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1843436pxu; Thu, 17 Dec 2020 22:13:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9v56Y96Rt2ryU1PAUlPt/qGfD+VX7Ajkel/KatDnCiEVBWUe6Ox9R9YFjfJwbkPDtT3js X-Received: by 2002:a17:907:11ca:: with SMTP id va10mr2441858ejb.78.1608272039291; Thu, 17 Dec 2020 22:13:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608272039; cv=none; d=google.com; s=arc-20160816; b=Ik/6UUa8k7foISB6NUQ7KM2+m/9R6rbBj8OD27DWVATq6ebE1PValzQqmsMYOLAU4B 6xfjGBYQItYabDgCrqaXZWOFOQqhKRTmhQR40sNrOFdvdvqyY7z9uh7NSInq3Lot1LR/ KzN9Hc97ce8mYvxeOtIxQf/PhWBh5u3d0rLZL1zecPpHPI6RZTCknfG7JygL/MrNR3Ap eaaswm8Wr+/UUNphVBLK62Y97WrDrZxwdP5F+/NzxAlUqvyCNXh7InBWeIuYbeF93xso R5nF65b/ME7GZDf9W/XOL2A4vDjkyxsOw3RJzLiGg7Ykt2m6WjgqJ2c4f5nmv1rQDrBh 0Hqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Gfzoa1k9DCjayeKHOti67b41px8Tibinrep3hNW3yr0=; b=VxNj7/VJPjduzHOwu/wSniW9I8Pg+NMTuZ/jsyArXo/EAyOxosir4VarMLCkkrEcYb ZUH6pH5NOrBiN+3OQa7Qyiw8SkGwbHcXPCNxaSNWAIuVgssms0K+dZdeKtW642dvZiUP DcaF3I/48TBd0gJmscq6IDvscAks2w8733gx7sJ4mq+MfCiZ4yCODI1Z9TinQEPXIXkb mwJFXq38RuScO2xuuYUgoa39k7LCi5p5QwxetMuqlGlMQNc76ZlFiWQsSPU4b5jG3IYv isA7qC+LYNPSuuCungGtK55NsaNaxP4aeNSrEnnjKVSv/UlRVrz1dxsdxM2froe+NQ0f Jj3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rk17si3902912ejb.509.2020.12.17.22.13.37; Thu, 17 Dec 2020 22:13:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732029AbgLRGLx (ORCPT + 99 others); Fri, 18 Dec 2020 01:11:53 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9227 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbgLRGLw (ORCPT ); Fri, 18 Dec 2020 01:11:52 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cxz4D1jSXzkqj6; Fri, 18 Dec 2020 14:10:20 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.498.0; Fri, 18 Dec 2020 14:11:02 +0800 From: Chen Zhou To: , , CC: , , Subject: [PATCH v2] cgroup-v1: add disabled controller check in cgroup1_parse_param() Date: Fri, 18 Dec 2020 14:17:55 +0800 Message-ID: <20201218061755.121205-1-chenzhou10@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When mounting a cgroup hierarchy with disabled controller in cgroup v1, all available controllers will be attached. Add disabled controller check in cgroup1_parse_param() and return directly if the specified controller is disabled. Signed-off-by: Chen Zhou --- Changes in v2: - Fix line over 80 characters warning. --- kernel/cgroup/cgroup-v1.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 191c329e482a..5190c42fea8b 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -915,6 +915,9 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) for_each_subsys(ss, i) { if (strcmp(param->key, ss->legacy_name)) continue; + if (!cgroup_ssid_enabled(i) || cgroup1_ssid_disabled(i)) + return invalfc(fc, "Disabled controller '%s'", + param->key); ctx->subsys_mask |= (1 << i); return 0; } -- 2.20.1