diff options
-rw-r--r-- | fs/autofs4/autofs_i.h | 8 | ||||
-rw-r--r-- | fs/autofs4/dev-ioctl.c | 4 | ||||
-rw-r--r-- | fs/autofs4/inode.c | 24 | ||||
-rw-r--r-- | fs/autofs4/waitq.c | 5 | ||||
-rw-r--r-- | init/Kconfig | 1 |
5 files changed, 24 insertions, 18 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 908e18455413..b785e7707959 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -74,8 +74,8 @@ struct autofs_info { | |||
74 | unsigned long last_used; | 74 | unsigned long last_used; |
75 | atomic_t count; | 75 | atomic_t count; |
76 | 76 | ||
77 | uid_t uid; | 77 | kuid_t uid; |
78 | gid_t gid; | 78 | kgid_t gid; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | #define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */ | 81 | #define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */ |
@@ -89,8 +89,8 @@ struct autofs_wait_queue { | |||
89 | struct qstr name; | 89 | struct qstr name; |
90 | u32 dev; | 90 | u32 dev; |
91 | u64 ino; | 91 | u64 ino; |
92 | uid_t uid; | 92 | kuid_t uid; |
93 | gid_t gid; | 93 | kgid_t gid; |
94 | pid_t pid; | 94 | pid_t pid; |
95 | pid_t tgid; | 95 | pid_t tgid; |
96 | /* This is for status reporting upon return */ | 96 | /* This is for status reporting upon return */ |
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index a16214109d31..9f68a37bb2b2 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
@@ -437,8 +437,8 @@ static int autofs_dev_ioctl_requester(struct file *fp, | |||
437 | err = 0; | 437 | err = 0; |
438 | autofs4_expire_wait(path.dentry); | 438 | autofs4_expire_wait(path.dentry); |
439 | spin_lock(&sbi->fs_lock); | 439 | spin_lock(&sbi->fs_lock); |
440 | param->requester.uid = ino->uid; | 440 | param->requester.uid = from_kuid_munged(current_user_ns(), ino->uid); |
441 | param->requester.gid = ino->gid; | 441 | param->requester.gid = from_kgid_munged(current_user_ns(), ino->gid); |
442 | spin_unlock(&sbi->fs_lock); | 442 | spin_unlock(&sbi->fs_lock); |
443 | } | 443 | } |
444 | path_put(&path); | 444 | path_put(&path); |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 8a4fed8ead30..b104726e2d0a 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -36,8 +36,8 @@ struct autofs_info *autofs4_new_ino(struct autofs_sb_info *sbi) | |||
36 | 36 | ||
37 | void autofs4_clean_ino(struct autofs_info *ino) | 37 | void autofs4_clean_ino(struct autofs_info *ino) |
38 | { | 38 | { |
39 | ino->uid = 0; | 39 | ino->uid = GLOBAL_ROOT_UID; |
40 | ino->gid = 0; | 40 | ino->gid = GLOBAL_ROOT_GID; |
41 | ino->last_used = jiffies; | 41 | ino->last_used = jiffies; |
42 | } | 42 | } |
43 | 43 | ||
@@ -79,10 +79,12 @@ static int autofs4_show_options(struct seq_file *m, struct dentry *root) | |||
79 | return 0; | 79 | return 0; |
80 | 80 | ||
81 | seq_printf(m, ",fd=%d", sbi->pipefd); | 81 | seq_printf(m, ",fd=%d", sbi->pipefd); |
82 | if (root_inode->i_uid != 0) | 82 | if (!uid_eq(root_inode->i_uid, GLOBAL_ROOT_UID)) |
83 | seq_printf(m, ",uid=%u", root_inode->i_uid); | 83 | seq_printf(m, ",uid=%u", |
84 | if (root_inode->i_gid != 0) | 84 | from_kuid_munged(&init_user_ns, root_inode->i_uid)); |
85 | seq_printf(m, ",gid=%u", root_inode->i_gid); | 85 | if (!gid_eq(root_inode->i_gid, GLOBAL_ROOT_GID)) |
86 | seq_printf(m, ",gid=%u", | ||
87 | from_kgid_munged(&init_user_ns, root_inode->i_gid)); | ||
86 | seq_printf(m, ",pgrp=%d", sbi->oz_pgrp); | 88 | seq_printf(m, ",pgrp=%d", sbi->oz_pgrp); |
87 | seq_printf(m, ",timeout=%lu", sbi->exp_timeout/HZ); | 89 | seq_printf(m, ",timeout=%lu", sbi->exp_timeout/HZ); |
88 | seq_printf(m, ",minproto=%d", sbi->min_proto); | 90 | seq_printf(m, ",minproto=%d", sbi->min_proto); |
@@ -126,7 +128,7 @@ static const match_table_t tokens = { | |||
126 | {Opt_err, NULL} | 128 | {Opt_err, NULL} |
127 | }; | 129 | }; |
128 | 130 | ||
129 | static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, | 131 | static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid, |
130 | pid_t *pgrp, unsigned int *type, int *minproto, int *maxproto) | 132 | pid_t *pgrp, unsigned int *type, int *minproto, int *maxproto) |
131 | { | 133 | { |
132 | char *p; | 134 | char *p; |
@@ -159,12 +161,16 @@ static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, | |||
159 | case Opt_uid: | 161 | case Opt_uid: |
160 | if (match_int(args, &option)) | 162 | if (match_int(args, &option)) |
161 | return 1; | 163 | return 1; |
162 | *uid = option; | 164 | *uid = make_kuid(current_user_ns(), option); |
165 | if (!uid_valid(*uid)) | ||
166 | return 1; | ||
163 | break; | 167 | break; |
164 | case Opt_gid: | 168 | case Opt_gid: |
165 | if (match_int(args, &option)) | 169 | if (match_int(args, &option)) |
166 | return 1; | 170 | return 1; |
167 | *gid = option; | 171 | *gid = make_kgid(current_user_ns(), option); |
172 | if (!gid_valid(*gid)) | ||
173 | return 1; | ||
168 | break; | 174 | break; |
169 | case Opt_pgrp: | 175 | case Opt_pgrp: |
170 | if (match_int(args, &option)) | 176 | if (match_int(args, &option)) |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index dce436e595c1..03bc1d347d8e 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -154,6 +154,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
154 | case autofs_ptype_expire_direct: | 154 | case autofs_ptype_expire_direct: |
155 | { | 155 | { |
156 | struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet; | 156 | struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet; |
157 | struct user_namespace *user_ns = sbi->pipe->f_cred->user_ns; | ||
157 | 158 | ||
158 | pktsz = sizeof(*packet); | 159 | pktsz = sizeof(*packet); |
159 | 160 | ||
@@ -163,8 +164,8 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
163 | packet->name[wq->name.len] = '\0'; | 164 | packet->name[wq->name.len] = '\0'; |
164 | packet->dev = wq->dev; | 165 | packet->dev = wq->dev; |
165 | packet->ino = wq->ino; | 166 | packet->ino = wq->ino; |
166 | packet->uid = wq->uid; | 167 | packet->uid = from_kuid_munged(user_ns, wq->uid); |
167 | packet->gid = wq->gid; | 168 | packet->gid = from_kgid_munged(user_ns, wq->gid); |
168 | packet->pid = wq->pid; | 169 | packet->pid = wq->pid; |
169 | packet->tgid = wq->tgid; | 170 | packet->tgid = wq->tgid; |
170 | break; | 171 | break; |
diff --git a/init/Kconfig b/init/Kconfig index 6fdd6e339326..b6369fbaa22b 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1004,7 +1004,6 @@ config UIDGID_CONVERTED | |||
1004 | # Filesystems | 1004 | # Filesystems |
1005 | depends on 9P_FS = n | 1005 | depends on 9P_FS = n |
1006 | depends on AFS_FS = n | 1006 | depends on AFS_FS = n |
1007 | depends on AUTOFS4_FS = n | ||
1008 | depends on CEPH_FS = n | 1007 | depends on CEPH_FS = n |
1009 | depends on CIFS = n | 1008 | depends on CIFS = n |
1010 | depends on CODA_FS = n | 1009 | depends on CODA_FS = n |