aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/udf/inode.c12
-rw-r--r--fs/udf/super.c20
-rw-r--r--fs/udf/udf_sb.h4
-rw-r--r--init/Kconfig1
4 files changed, 20 insertions, 17 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index fafaad795cd6..1825dc0af728 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1309,14 +1309,14 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1309 } 1309 }
1310 1310
1311 read_lock(&sbi->s_cred_lock); 1311 read_lock(&sbi->s_cred_lock);
1312 inode->i_uid = le32_to_cpu(fe->uid); 1312 i_uid_write(inode, le32_to_cpu(fe->uid));
1313 if (inode->i_uid == -1 || 1313 if (!uid_valid(inode->i_uid) ||
1314 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_IGNORE) || 1314 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_IGNORE) ||
1315 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_SET)) 1315 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_SET))
1316 inode->i_uid = UDF_SB(inode->i_sb)->s_uid; 1316 inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
1317 1317
1318 inode->i_gid = le32_to_cpu(fe->gid); 1318 i_gid_write(inode, le32_to_cpu(fe->gid));
1319 if (inode->i_gid == -1 || 1319 if (!gid_valid(inode->i_gid) ||
1320 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_IGNORE) || 1320 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_IGNORE) ||
1321 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_SET)) 1321 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_SET))
1322 inode->i_gid = UDF_SB(inode->i_sb)->s_gid; 1322 inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
@@ -1539,12 +1539,12 @@ static int udf_update_inode(struct inode *inode, int do_sync)
1539 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) 1539 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET))
1540 fe->uid = cpu_to_le32(-1); 1540 fe->uid = cpu_to_le32(-1);
1541 else 1541 else
1542 fe->uid = cpu_to_le32(inode->i_uid); 1542 fe->uid = cpu_to_le32(i_uid_read(inode));
1543 1543
1544 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET)) 1544 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET))
1545 fe->gid = cpu_to_le32(-1); 1545 fe->gid = cpu_to_le32(-1);
1546 else 1546 else
1547 fe->gid = cpu_to_le32(inode->i_gid); 1547 fe->gid = cpu_to_le32(i_gid_read(inode));
1548 1548
1549 udfperms = ((inode->i_mode & S_IRWXO)) | 1549 udfperms = ((inode->i_mode & S_IRWXO)) |
1550 ((inode->i_mode & S_IRWXG) << 2) | 1550 ((inode->i_mode & S_IRWXG) << 2) |
diff --git a/fs/udf/super.c b/fs/udf/super.c
index dcbf98722afc..38c705574b92 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -199,8 +199,8 @@ struct udf_options {
199 unsigned int rootdir; 199 unsigned int rootdir;
200 unsigned int flags; 200 unsigned int flags;
201 umode_t umask; 201 umode_t umask;
202 gid_t gid; 202 kgid_t gid;
203 uid_t uid; 203 kuid_t uid;
204 umode_t fmode; 204 umode_t fmode;
205 umode_t dmode; 205 umode_t dmode;
206 struct nls_table *nls_map; 206 struct nls_table *nls_map;
@@ -335,9 +335,9 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root)
335 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_IGNORE)) 335 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_IGNORE))
336 seq_puts(seq, ",gid=ignore"); 336 seq_puts(seq, ",gid=ignore");
337 if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET)) 337 if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET))
338 seq_printf(seq, ",uid=%u", sbi->s_uid); 338 seq_printf(seq, ",uid=%u", from_kuid(&init_user_ns, sbi->s_uid));
339 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET)) 339 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET))
340 seq_printf(seq, ",gid=%u", sbi->s_gid); 340 seq_printf(seq, ",gid=%u", from_kgid(&init_user_ns, sbi->s_gid));
341 if (sbi->s_umask != 0) 341 if (sbi->s_umask != 0)
342 seq_printf(seq, ",umask=%ho", sbi->s_umask); 342 seq_printf(seq, ",umask=%ho", sbi->s_umask);
343 if (sbi->s_fmode != UDF_INVALID_MODE) 343 if (sbi->s_fmode != UDF_INVALID_MODE)
@@ -516,13 +516,17 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
516 case Opt_gid: 516 case Opt_gid:
517 if (match_int(args, &option)) 517 if (match_int(args, &option))
518 return 0; 518 return 0;
519 uopt->gid = option; 519 uopt->gid = make_kgid(current_user_ns(), option);
520 if (!gid_valid(uopt->gid))
521 return 0;
520 uopt->flags |= (1 << UDF_FLAG_GID_SET); 522 uopt->flags |= (1 << UDF_FLAG_GID_SET);
521 break; 523 break;
522 case Opt_uid: 524 case Opt_uid:
523 if (match_int(args, &option)) 525 if (match_int(args, &option))
524 return 0; 526 return 0;
525 uopt->uid = option; 527 uopt->uid = make_kuid(current_user_ns(), option);
528 if (!uid_valid(uopt->uid))
529 return 0;
526 uopt->flags |= (1 << UDF_FLAG_UID_SET); 530 uopt->flags |= (1 << UDF_FLAG_UID_SET);
527 break; 531 break;
528 case Opt_umask: 532 case Opt_umask:
@@ -1931,8 +1935,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
1931 struct udf_sb_info *sbi; 1935 struct udf_sb_info *sbi;
1932 1936
1933 uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); 1937 uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
1934 uopt.uid = -1; 1938 uopt.uid = INVALID_UID;
1935 uopt.gid = -1; 1939 uopt.gid = INVALID_GID;
1936 uopt.umask = 0; 1940 uopt.umask = 0;
1937 uopt.fmode = UDF_INVALID_MODE; 1941 uopt.fmode = UDF_INVALID_MODE;
1938 uopt.dmode = UDF_INVALID_MODE; 1942 uopt.dmode = UDF_INVALID_MODE;
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index 42ad69ac9576..5f027227f085 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -128,8 +128,8 @@ struct udf_sb_info {
128 128
129 /* Default permissions */ 129 /* Default permissions */
130 umode_t s_umask; 130 umode_t s_umask;
131 gid_t s_gid; 131 kgid_t s_gid;
132 uid_t s_uid; 132 kuid_t s_uid;
133 umode_t s_fmode; 133 umode_t s_fmode;
134 umode_t s_dmode; 134 umode_t s_dmode;
135 /* Lock protecting consistency of above permission settings */ 135 /* Lock protecting consistency of above permission settings */
diff --git a/init/Kconfig b/init/Kconfig
index 21adc1c997ad..6f9819ac322b 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -939,7 +939,6 @@ config UIDGID_CONVERTED
939 depends on NFSD = n 939 depends on NFSD = n
940 depends on NFS_FS = n 940 depends on NFS_FS = n
941 depends on OCFS2_FS = n 941 depends on OCFS2_FS = n
942 depends on UDF_FS = n
943 depends on UFS_FS = n 942 depends on UFS_FS = n
944 depends on XFS_FS = n 943 depends on XFS_FS = n
945 944