aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs/linuxvfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/befs/linuxvfs.c')
-rw-r--r--fs/befs/linuxvfs.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index cf7f3c67c8b7..2b3bda8d5e68 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -15,6 +15,7 @@
15#include <linux/vfs.h> 15#include <linux/vfs.h>
16#include <linux/parser.h> 16#include <linux/parser.h>
17#include <linux/namei.h> 17#include <linux/namei.h>
18#include <linux/sched.h>
18 19
19#include "befs.h" 20#include "befs.h"
20#include "btree.h" 21#include "btree.h"
@@ -352,9 +353,11 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
352 */ 353 */
353 354
354 inode->i_uid = befs_sb->mount_opts.use_uid ? 355 inode->i_uid = befs_sb->mount_opts.use_uid ?
355 befs_sb->mount_opts.uid : (uid_t) fs32_to_cpu(sb, raw_inode->uid); 356 befs_sb->mount_opts.uid :
357 make_kuid(&init_user_ns, fs32_to_cpu(sb, raw_inode->uid));
356 inode->i_gid = befs_sb->mount_opts.use_gid ? 358 inode->i_gid = befs_sb->mount_opts.use_gid ?
357 befs_sb->mount_opts.gid : (gid_t) fs32_to_cpu(sb, raw_inode->gid); 359 befs_sb->mount_opts.gid :
360 make_kgid(&init_user_ns, fs32_to_cpu(sb, raw_inode->gid));
358 361
359 set_nlink(inode, 1); 362 set_nlink(inode, 1);
360 363
@@ -454,6 +457,11 @@ befs_init_inodecache(void)
454static void 457static void
455befs_destroy_inodecache(void) 458befs_destroy_inodecache(void)
456{ 459{
460 /*
461 * Make sure all delayed rcu free inodes are flushed before we
462 * destroy cache.
463 */
464 rcu_barrier();
457 kmem_cache_destroy(befs_inode_cachep); 465 kmem_cache_destroy(befs_inode_cachep);
458} 466}
459 467
@@ -674,10 +682,12 @@ parse_options(char *options, befs_mount_options * opts)
674 char *p; 682 char *p;
675 substring_t args[MAX_OPT_ARGS]; 683 substring_t args[MAX_OPT_ARGS];
676 int option; 684 int option;
685 kuid_t uid;
686 kgid_t gid;
677 687
678 /* Initialize options */ 688 /* Initialize options */
679 opts->uid = 0; 689 opts->uid = GLOBAL_ROOT_UID;
680 opts->gid = 0; 690 opts->gid = GLOBAL_ROOT_GID;
681 opts->use_uid = 0; 691 opts->use_uid = 0;
682 opts->use_gid = 0; 692 opts->use_gid = 0;
683 opts->iocharset = NULL; 693 opts->iocharset = NULL;
@@ -696,23 +706,29 @@ parse_options(char *options, befs_mount_options * opts)
696 case Opt_uid: 706 case Opt_uid:
697 if (match_int(&args[0], &option)) 707 if (match_int(&args[0], &option))
698 return 0; 708 return 0;
699 if (option < 0) { 709 uid = INVALID_UID;
710 if (option >= 0)
711 uid = make_kuid(current_user_ns(), option);
712 if (!uid_valid(uid)) {
700 printk(KERN_ERR "BeFS: Invalid uid %d, " 713 printk(KERN_ERR "BeFS: Invalid uid %d, "
701 "using default\n", option); 714 "using default\n", option);
702 break; 715 break;
703 } 716 }
704 opts->uid = option; 717 opts->uid = uid;
705 opts->use_uid = 1; 718 opts->use_uid = 1;
706 break; 719 break;
707 case Opt_gid: 720 case Opt_gid:
708 if (match_int(&args[0], &option)) 721 if (match_int(&args[0], &option))
709 return 0; 722 return 0;
710 if (option < 0) { 723 gid = INVALID_GID;
724 if (option >= 0)
725 gid = make_kgid(current_user_ns(), option);
726 if (!gid_valid(gid)) {
711 printk(KERN_ERR "BeFS: Invalid gid %d, " 727 printk(KERN_ERR "BeFS: Invalid gid %d, "
712 "using default\n", option); 728 "using default\n", option);
713 break; 729 break;
714 } 730 }
715 opts->gid = option; 731 opts->gid = gid;
716 opts->use_gid = 1; 732 opts->use_gid = 1;
717 break; 733 break;
718 case Opt_charset: 734 case Opt_charset: