Return-Path: Received: from mx2.suse.de ([195.135.220.15]:36025 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753348AbeBVKpZ (ORCPT ); Thu, 22 Feb 2018 05:45:25 -0500 From: Jan Kara To: Cc: Steve Kenton , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Jan Kara Subject: [PATCH 4/5] udf: Provide saner default for invalid uid / gid Date: Thu, 22 Feb 2018 11:45:18 +0100 Message-Id: <20180222104519.30241-5-jack@suse.cz> In-Reply-To: <20180222104519.30241-1-jack@suse.cz> References: <20180222104519.30241-1-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Currently when UDF filesystem is recorded without uid / gid (ids are set to -1), we will assign INVALID_[UG]ID to vfs inode unless user uses uid= and gid= mount options. In such case filesystem could not be modified in any way as VFS refuses to modify files with invalid ids (even by root). This is confusing to users and not very useful default since such media mode is generally used for removable media. Use overflow[ug]id instead so that at least root can modify the filesystem. Reported-by: Steve Kenton Signed-off-by: Jan Kara --- fs/udf/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/udf/super.c b/fs/udf/super.c index 4543338d1b0f..79a949d4a373 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -2085,8 +2085,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) bool lvid_open = false; uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); - uopt.uid = INVALID_UID; - uopt.gid = INVALID_GID; + /* By default we'll use overflow[ug]id when UDF inode [ug]id == -1 */ + uopt.uid = make_kuid(current_user_ns(), overflowuid); + uopt.gid = make_kgid(current_user_ns(), overflowgid); uopt.umask = 0; uopt.fmode = UDF_INVALID_MODE; uopt.dmode = UDF_INVALID_MODE; -- 2.13.6