forked from luck/tmp_suning_uos_patched
userns: Convert hfsplus to use kuid and kgid where appropriate
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
This commit is contained in:
parent
43b5e4ccd4
commit
16525e3f14
|
@ -80,8 +80,8 @@ void hfsplus_cat_set_perms(struct inode *inode, struct hfsplus_perm *perms)
|
|||
|
||||
perms->userflags = HFSPLUS_I(inode)->userflags;
|
||||
perms->mode = cpu_to_be16(inode->i_mode);
|
||||
perms->owner = cpu_to_be32(inode->i_uid);
|
||||
perms->group = cpu_to_be32(inode->i_gid);
|
||||
perms->owner = cpu_to_be32(i_uid_read(inode));
|
||||
perms->group = cpu_to_be32(i_gid_read(inode));
|
||||
|
||||
if (S_ISREG(inode->i_mode))
|
||||
perms->dev = cpu_to_be32(inode->i_nlink);
|
||||
|
|
|
@ -149,8 +149,8 @@ struct hfsplus_sb_info {
|
|||
u32 type;
|
||||
|
||||
umode_t umask;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
kuid_t uid;
|
||||
kgid_t gid;
|
||||
|
||||
int part, session;
|
||||
unsigned long flags;
|
||||
|
|
|
@ -233,12 +233,12 @@ static void hfsplus_get_perms(struct inode *inode,
|
|||
|
||||
mode = be16_to_cpu(perms->mode);
|
||||
|
||||
inode->i_uid = be32_to_cpu(perms->owner);
|
||||
if (!inode->i_uid && !mode)
|
||||
i_uid_write(inode, be32_to_cpu(perms->owner));
|
||||
if (!i_uid_read(inode) && !mode)
|
||||
inode->i_uid = sbi->uid;
|
||||
|
||||
inode->i_gid = be32_to_cpu(perms->group);
|
||||
if (!inode->i_gid && !mode)
|
||||
i_gid_write(inode, be32_to_cpu(perms->group));
|
||||
if (!i_gid_read(inode) && !mode)
|
||||
inode->i_gid = sbi->gid;
|
||||
|
||||
if (dir) {
|
||||
|
|
|
@ -135,14 +135,22 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
|
|||
printk(KERN_ERR "hfs: uid requires an argument\n");
|
||||
return 0;
|
||||
}
|
||||
sbi->uid = (uid_t)tmp;
|
||||
sbi->uid = make_kuid(current_user_ns(), (uid_t)tmp);
|
||||
if (!uid_valid(sbi->uid)) {
|
||||
printk(KERN_ERR "hfs: invalid uid specified\n");
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case opt_gid:
|
||||
if (match_int(&args[0], &tmp)) {
|
||||
printk(KERN_ERR "hfs: gid requires an argument\n");
|
||||
return 0;
|
||||
}
|
||||
sbi->gid = (gid_t)tmp;
|
||||
sbi->gid = make_kgid(current_user_ns(), (gid_t)tmp);
|
||||
if (!gid_valid(sbi->gid)) {
|
||||
printk(KERN_ERR "hfs: invalid gid specified\n");
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case opt_part:
|
||||
if (match_int(&args[0], &sbi->part)) {
|
||||
|
@ -215,7 +223,8 @@ int hfsplus_show_options(struct seq_file *seq, struct dentry *root)
|
|||
if (sbi->type != HFSPLUS_DEF_CR_TYPE)
|
||||
seq_printf(seq, ",type=%.4s", (char *)&sbi->type);
|
||||
seq_printf(seq, ",umask=%o,uid=%u,gid=%u", sbi->umask,
|
||||
sbi->uid, sbi->gid);
|
||||
from_kuid_munged(&init_user_ns, sbi->uid),
|
||||
from_kgid_munged(&init_user_ns, sbi->gid));
|
||||
if (sbi->part >= 0)
|
||||
seq_printf(seq, ",part=%u", sbi->part);
|
||||
if (sbi->session >= 0)
|
||||
|
|
|
@ -943,7 +943,6 @@ config UIDGID_CONVERTED
|
|||
depends on CODA_FS = n
|
||||
depends on FUSE_FS = n
|
||||
depends on GFS2_FS = n
|
||||
depends on HFSPLUS_FS = n
|
||||
depends on HPFS_FS = n
|
||||
depends on ISO9660_FS = n
|
||||
depends on JFFS2_FS = n
|
||||
|
|
Loading…
Reference in New Issue
Block a user