Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2689085imj; Mon, 11 Feb 2019 07:04:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IYswVqeb1BqUQHNNCX3jB/Si5UoBhzfvMz8b1g+fdqAtgBVsTrEYzBbSGMClbTK41BGoT42 X-Received: by 2002:a62:9604:: with SMTP id c4mr6475168pfe.200.1549897443136; Mon, 11 Feb 2019 07:04:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897443; cv=none; d=google.com; s=arc-20160816; b=Ef9YLjeY3fW8MazuXK8dwR8Vqq9XYDBnNumeehp00sepGBSBnwfv8HrrWAj289+OCT O4u3NaqdI+CVCwC+g5e42ghvGSGBhYhuDNiwxmUuGGIe+cnUVRzgOAbB4Y1C2Kp//aFP cVXW8m2ozgVdxPCLojh7klIDA99ys+z8IPU+JAzEGyct17L9x1tiA5frtu4N7DOVuh50 FdfS8MIj/KuuivZEniCLMJh3CltSQs8yMjoE5Iw4BGEiquaGwG8jubHxo7bnn/8fsrMv rzCLxTPeefJhpw3hPJxu0k7yjOFeOCwW8xobVWjP3W9AYWgb6s1j8loImeYugQLUg5QQ CCpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ruDs9Cx9zUFJkpwxvMahtNxU2eawkNHDzb9L+exYIg4=; b=P1av1TzMJpcEf1oBXlxXJBQh4Cj1qkgVHeB1lu9FWdKxZkdBp5BV8Qxawph4z2oolE 4aBZtspWN+uQhlWnGkhaiUvoFGnDVaL7ExCpa6i4b0hcWYpXOw9LPDZ/LKIyJYZA6+cr 8xNFOO8YblWVqIYkYniWBQjoL+0xgPDlk0CakqGGHoUbfnuIXW7ux4t5rx09G1ABJm3v XlieKsCr0gvRimEt1sLzBcXVl5fR1BqxYTjAalIU9MfIqwoAKyupK2HAZdcNMRqX121m c2/Vkr08M2LsGSp7PTqscdMkCKMpKPdWAjm6V8C6PrsSfUxMOTUWk8daSwrdTRDqci59 X58A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OjTpWLsh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6si9443957pgc.589.2019.02.11.07.03.39; Mon, 11 Feb 2019 07:04:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OjTpWLsh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390155AbfBKPBP (ORCPT + 99 others); Mon, 11 Feb 2019 10:01:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:49248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390143AbfBKPBO (ORCPT ); Mon, 11 Feb 2019 10:01:14 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E81B222A4; Mon, 11 Feb 2019 15:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897273; bh=W44vFj6RbikcoEGhUUk1V7umZaGSQPP8ghmYBTxtmXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OjTpWLshlJuOu55A+yxKrtJuAMYaToSmnMJjD/3vS+omU4/Deh+nh0L26+xR5X5Hp XdiViq3pHR8JYsSD7/re8St9POVWyOoKLZJcusGFF/t5ThEEtKk7D1IF6J9aIPjk96 GTELqbY+4+lNNr1AEdWfEEoRe0oGwoHVNVwTzj6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Smalley , Ondrej Mosnacek , Tejun Heo , Sasha Levin Subject: [PATCH 4.14 146/205] cgroup: fix parsing empty mount option string Date: Mon, 11 Feb 2019 15:19:04 +0100 Message-Id: <20190211141837.901709562@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit e250d91d65750a0c0c62483ac4f9f357e7317617 ] This fixes the case where all mount options specified are consumed by an LSM and all that's left is an empty string. In this case cgroupfs should accept the string and not fail. How to reproduce (with SELinux enabled): # umount /sys/fs/cgroup/unified # mount -o context=system_u:object_r:cgroup_t:s0 -t cgroup2 cgroup2 /sys/fs/cgroup/unified mount: /sys/fs/cgroup/unified: wrong fs type, bad option, bad superblock on cgroup2, missing codepage or helper program, or other error. # dmesg | tail -n 1 [ 31.575952] cgroup: cgroup2: unknown option "" Fixes: 67e9c74b8a87 ("cgroup: replace __DEVEL__sane_behavior with cgroup2 fs type") [NOTE: should apply on top of commit 5136f6365ce3 ("cgroup: implement "nsdelegate" mount option"), older versions need manual rebase] Suggested-by: Stephen Smalley Signed-off-by: Ondrej Mosnacek Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/cgroup/cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 109c32c56de7..21bbfc09e395 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -1692,7 +1692,7 @@ static int parse_cgroup_root_flags(char *data, unsigned int *root_flags) *root_flags = 0; - if (!data) + if (!data || *data == '\0') return 0; while ((token = strsep(&data, ",")) != NULL) { -- 2.19.1