userns: Convert isofs to use kuid/kgid where appropriate
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 10 Feb 2012 19:35:50 +0000 (11:35 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 21 Sep 2012 10:13:12 +0000 (03:13 -0700)
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
fs/isofs/inode.c
fs/isofs/isofs.h
fs/isofs/rock.c
init/Kconfig

index 29037c365ba4f4807eca405680def2c78353f966..a7d8e6cc5e0c140cb29253c1d9433215584c6ccf 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/cdrom.h>
 #include <linux/parser.h>
 #include <linux/mpage.h>
+#include <linux/user_namespace.h>
 
 #include "isofs.h"
 #include "zisofs.h"
@@ -171,8 +172,8 @@ struct iso9660_options{
        unsigned int blocksize;
        umode_t fmode;
        umode_t dmode;
-       gid_t gid;
-       uid_t uid;
+       kgid_t gid;
+       kuid_t uid;
        char *iocharset;
        /* LVE */
        s32 session;
@@ -383,8 +384,8 @@ static int parse_options(char *options, struct iso9660_options *popt)
        popt->fmode = popt->dmode = ISOFS_INVALID_MODE;
        popt->uid_set = 0;
        popt->gid_set = 0;
-       popt->gid = 0;
-       popt->uid = 0;
+       popt->gid = GLOBAL_ROOT_GID;
+       popt->uid = GLOBAL_ROOT_UID;
        popt->iocharset = NULL;
        popt->utf8 = 0;
        popt->overriderockperm = 0;
@@ -460,13 +461,17 @@ static int parse_options(char *options, struct iso9660_options *popt)
                case Opt_uid:
                        if (match_int(&args[0], &option))
                                return 0;
-                       popt->uid = option;
+                       popt->uid = make_kuid(current_user_ns(), option);
+                       if (!uid_valid(popt->uid))
+                               return 0;
                        popt->uid_set = 1;
                        break;
                case Opt_gid:
                        if (match_int(&args[0], &option))
                                return 0;
-                       popt->gid = option;
+                       popt->gid = make_kgid(current_user_ns(), option);
+                       if (!gid_valid(popt->gid))
+                               return 0;
                        popt->gid_set = 1;
                        break;
                case Opt_mode:
index 3620ad1ea9bcfc31cf2814ad98df9896cbd8bba9..99167238518d61a30c4a5e6bfc838291d6206a5d 100644 (file)
@@ -52,8 +52,8 @@ struct isofs_sb_info {
 
        umode_t s_fmode;
        umode_t s_dmode;
-       gid_t s_gid;
-       uid_t s_uid;
+       kgid_t s_gid;
+       kuid_t s_uid;
        struct nls_table *s_nls_iocharset; /* Native language support table */
 };
 
index 70e79d0c756a9418155239f18f68d55323809e08..c0bf42472e408fd16911cee33f3d9079943aa46a 100644 (file)
@@ -364,8 +364,8 @@ repeat:
                case SIG('P', 'X'):
                        inode->i_mode = isonum_733(rr->u.PX.mode);
                        set_nlink(inode, isonum_733(rr->u.PX.n_links));
-                       inode->i_uid = isonum_733(rr->u.PX.uid);
-                       inode->i_gid = isonum_733(rr->u.PX.gid);
+                       i_uid_write(inode, isonum_733(rr->u.PX.uid));
+                       i_gid_write(inode, isonum_733(rr->u.PX.gid));
                        break;
                case SIG('P', 'N'):
                        {
index 9cf8cb1f618b942bbbf52c8b4e780d14d93448b4..88f6571d4dd45ae039cb2649c93f549993548b37 100644 (file)
@@ -944,7 +944,6 @@ config UIDGID_CONVERTED
        depends on FUSE_FS = n
        depends on GFS2_FS = n
        depends on HPFS_FS = n
-       depends on ISO9660_FS = n
        depends on JFFS2_FS = n
        depends on JFS_FS = n
        depends on LOGFS = n