aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r--fs/udf/super.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index dcbf98722afc..d44fb568abe1 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -171,6 +171,11 @@ static int init_inodecache(void)
171 171
172static void destroy_inodecache(void) 172static void destroy_inodecache(void)
173{ 173{
174 /*
175 * Make sure all delayed rcu free inodes are flushed before we
176 * destroy cache.
177 */
178 rcu_barrier();
174 kmem_cache_destroy(udf_inode_cachep); 179 kmem_cache_destroy(udf_inode_cachep);
175} 180}
176 181
@@ -199,8 +204,8 @@ struct udf_options {
199 unsigned int rootdir; 204 unsigned int rootdir;
200 unsigned int flags; 205 unsigned int flags;
201 umode_t umask; 206 umode_t umask;
202 gid_t gid; 207 kgid_t gid;
203 uid_t uid; 208 kuid_t uid;
204 umode_t fmode; 209 umode_t fmode;
205 umode_t dmode; 210 umode_t dmode;
206 struct nls_table *nls_map; 211 struct nls_table *nls_map;
@@ -335,9 +340,9 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root)
335 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_IGNORE)) 340 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_IGNORE))
336 seq_puts(seq, ",gid=ignore"); 341 seq_puts(seq, ",gid=ignore");
337 if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET)) 342 if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET))
338 seq_printf(seq, ",uid=%u", sbi->s_uid); 343 seq_printf(seq, ",uid=%u", from_kuid(&init_user_ns, sbi->s_uid));
339 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET)) 344 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET))
340 seq_printf(seq, ",gid=%u", sbi->s_gid); 345 seq_printf(seq, ",gid=%u", from_kgid(&init_user_ns, sbi->s_gid));
341 if (sbi->s_umask != 0) 346 if (sbi->s_umask != 0)
342 seq_printf(seq, ",umask=%ho", sbi->s_umask); 347 seq_printf(seq, ",umask=%ho", sbi->s_umask);
343 if (sbi->s_fmode != UDF_INVALID_MODE) 348 if (sbi->s_fmode != UDF_INVALID_MODE)
@@ -516,13 +521,17 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
516 case Opt_gid: 521 case Opt_gid:
517 if (match_int(args, &option)) 522 if (match_int(args, &option))
518 return 0; 523 return 0;
519 uopt->gid = option; 524 uopt->gid = make_kgid(current_user_ns(), option);
525 if (!gid_valid(uopt->gid))
526 return 0;
520 uopt->flags |= (1 << UDF_FLAG_GID_SET); 527 uopt->flags |= (1 << UDF_FLAG_GID_SET);
521 break; 528 break;
522 case Opt_uid: 529 case Opt_uid:
523 if (match_int(args, &option)) 530 if (match_int(args, &option))
524 return 0; 531 return 0;
525 uopt->uid = option; 532 uopt->uid = make_kuid(current_user_ns(), option);
533 if (!uid_valid(uopt->uid))
534 return 0;
526 uopt->flags |= (1 << UDF_FLAG_UID_SET); 535 uopt->flags |= (1 << UDF_FLAG_UID_SET);
527 break; 536 break;
528 case Opt_umask: 537 case Opt_umask:
@@ -1344,6 +1353,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1344 udf_err(sb, "error loading logical volume descriptor: " 1353 udf_err(sb, "error loading logical volume descriptor: "
1345 "Partition table too long (%u > %lu)\n", table_len, 1354 "Partition table too long (%u > %lu)\n", table_len,
1346 sb->s_blocksize - sizeof(*lvd)); 1355 sb->s_blocksize - sizeof(*lvd));
1356 ret = 1;
1347 goto out_bh; 1357 goto out_bh;
1348 } 1358 }
1349 1359
@@ -1388,8 +1398,10 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1388 UDF_ID_SPARABLE, 1398 UDF_ID_SPARABLE,
1389 strlen(UDF_ID_SPARABLE))) { 1399 strlen(UDF_ID_SPARABLE))) {
1390 if (udf_load_sparable_map(sb, map, 1400 if (udf_load_sparable_map(sb, map,
1391 (struct sparablePartitionMap *)gpm) < 0) 1401 (struct sparablePartitionMap *)gpm) < 0) {
1402 ret = 1;
1392 goto out_bh; 1403 goto out_bh;
1404 }
1393 } else if (!strncmp(upm2->partIdent.ident, 1405 } else if (!strncmp(upm2->partIdent.ident,
1394 UDF_ID_METADATA, 1406 UDF_ID_METADATA,
1395 strlen(UDF_ID_METADATA))) { 1407 strlen(UDF_ID_METADATA))) {
@@ -1931,8 +1943,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
1931 struct udf_sb_info *sbi; 1943 struct udf_sb_info *sbi;
1932 1944
1933 uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); 1945 uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
1934 uopt.uid = -1; 1946 uopt.uid = INVALID_UID;
1935 uopt.gid = -1; 1947 uopt.gid = INVALID_GID;
1936 uopt.umask = 0; 1948 uopt.umask = 0;
1937 uopt.fmode = UDF_INVALID_MODE; 1949 uopt.fmode = UDF_INVALID_MODE;
1938 uopt.dmode = UDF_INVALID_MODE; 1950 uopt.dmode = UDF_INVALID_MODE;
@@ -2000,6 +2012,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
2000 if (!silent) 2012 if (!silent)
2001 pr_notice("Rescanning with blocksize %d\n", 2013 pr_notice("Rescanning with blocksize %d\n",
2002 UDF_DEFAULT_BLOCKSIZE); 2014 UDF_DEFAULT_BLOCKSIZE);
2015 brelse(sbi->s_lvid_bh);
2016 sbi->s_lvid_bh = NULL;
2003 uopt.blocksize = UDF_DEFAULT_BLOCKSIZE; 2017 uopt.blocksize = UDF_DEFAULT_BLOCKSIZE;
2004 ret = udf_load_vrs(sb, &uopt, silent, &fileset); 2018 ret = udf_load_vrs(sb, &uopt, silent, &fileset);
2005 } 2019 }