summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2018-02-22 10:39:52 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-30 08:17:41 +0200
commit8382e33e3446705b5c6175c16bab1e780befab02 (patch)
tree2067e2ee65e22244f9e304d61bfdc7b3019af6e6
parentd81cc2704e4536b3a56e607567bf4f9449715c1d (diff)
downloadlinux-stable-8382e33e3446705b5c6175c16bab1e780befab02.tar.gz
linux-stable-8382e33e3446705b5c6175c16bab1e780befab02.tar.bz2
linux-stable-8382e33e3446705b5c6175c16bab1e780befab02.zip
udf: Provide saner default for invalid uid / gid
[ Upstream commit 116e5258e4115aca0c64ac0bf40ded3b353ed626 ] 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 <skenton@ou.edu> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/udf/super.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index f73239a9a97d..8e5d6d29b6cf 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -2091,8 +2091,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;