diff options
Diffstat (limited to 'fs/affs')
-rw-r--r-- | fs/affs/affs.h | 4 | ||||
-rw-r--r-- | fs/affs/inode.c | 20 | ||||
-rw-r--r-- | fs/affs/super.c | 25 |
3 files changed, 29 insertions, 20 deletions
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index 6e216419f340..3952121f2f28 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -88,8 +88,8 @@ struct affs_sb_info { | |||
88 | u32 s_root_block; /* FFS root block number. */ | 88 | u32 s_root_block; /* FFS root block number. */ |
89 | int s_hashsize; /* Size of hash table. */ | 89 | int s_hashsize; /* Size of hash table. */ |
90 | unsigned long s_flags; /* See below. */ | 90 | unsigned long s_flags; /* See below. */ |
91 | uid_t s_uid; /* uid to override */ | 91 | kuid_t s_uid; /* uid to override */ |
92 | gid_t s_gid; /* gid to override */ | 92 | kgid_t s_gid; /* gid to override */ |
93 | umode_t s_mode; /* mode to override */ | 93 | umode_t s_mode; /* mode to override */ |
94 | struct buffer_head *s_root_bh; /* Cached root block. */ | 94 | struct buffer_head *s_root_bh; /* Cached root block. */ |
95 | struct mutex s_bmlock; /* Protects bitmap access. */ | 95 | struct mutex s_bmlock; /* Protects bitmap access. */ |
diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 8bc4a59f4e7e..15c484268229 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c | |||
@@ -80,17 +80,17 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) | |||
80 | if (id == 0 || sbi->s_flags & SF_SETUID) | 80 | if (id == 0 || sbi->s_flags & SF_SETUID) |
81 | inode->i_uid = sbi->s_uid; | 81 | inode->i_uid = sbi->s_uid; |
82 | else if (id == 0xFFFF && sbi->s_flags & SF_MUFS) | 82 | else if (id == 0xFFFF && sbi->s_flags & SF_MUFS) |
83 | inode->i_uid = 0; | 83 | i_uid_write(inode, 0); |
84 | else | 84 | else |
85 | inode->i_uid = id; | 85 | i_uid_write(inode, id); |
86 | 86 | ||
87 | id = be16_to_cpu(tail->gid); | 87 | id = be16_to_cpu(tail->gid); |
88 | if (id == 0 || sbi->s_flags & SF_SETGID) | 88 | if (id == 0 || sbi->s_flags & SF_SETGID) |
89 | inode->i_gid = sbi->s_gid; | 89 | inode->i_gid = sbi->s_gid; |
90 | else if (id == 0xFFFF && sbi->s_flags & SF_MUFS) | 90 | else if (id == 0xFFFF && sbi->s_flags & SF_MUFS) |
91 | inode->i_gid = 0; | 91 | i_gid_write(inode, 0); |
92 | else | 92 | else |
93 | inode->i_gid = id; | 93 | i_gid_write(inode, id); |
94 | 94 | ||
95 | switch (be32_to_cpu(tail->stype)) { | 95 | switch (be32_to_cpu(tail->stype)) { |
96 | case ST_ROOT: | 96 | case ST_ROOT: |
@@ -193,13 +193,13 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
193 | tail->size = cpu_to_be32(inode->i_size); | 193 | tail->size = cpu_to_be32(inode->i_size); |
194 | secs_to_datestamp(inode->i_mtime.tv_sec,&tail->change); | 194 | secs_to_datestamp(inode->i_mtime.tv_sec,&tail->change); |
195 | if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) { | 195 | if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) { |
196 | uid = inode->i_uid; | 196 | uid = i_uid_read(inode); |
197 | gid = inode->i_gid; | 197 | gid = i_gid_read(inode); |
198 | if (AFFS_SB(sb)->s_flags & SF_MUFS) { | 198 | if (AFFS_SB(sb)->s_flags & SF_MUFS) { |
199 | if (inode->i_uid == 0 || inode->i_uid == 0xFFFF) | 199 | if (uid == 0 || uid == 0xFFFF) |
200 | uid = inode->i_uid ^ ~0; | 200 | uid = uid ^ ~0; |
201 | if (inode->i_gid == 0 || inode->i_gid == 0xFFFF) | 201 | if (gid == 0 || gid == 0xFFFF) |
202 | gid = inode->i_gid ^ ~0; | 202 | gid = gid ^ ~0; |
203 | } | 203 | } |
204 | if (!(AFFS_SB(sb)->s_flags & SF_SETUID)) | 204 | if (!(AFFS_SB(sb)->s_flags & SF_SETUID)) |
205 | tail->uid = cpu_to_be16(uid); | 205 | tail->uid = cpu_to_be16(uid); |
diff --git a/fs/affs/super.c b/fs/affs/super.c index c70f1e5fc024..b84dc7352502 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -147,6 +147,11 @@ static int init_inodecache(void) | |||
147 | 147 | ||
148 | static void destroy_inodecache(void) | 148 | static void destroy_inodecache(void) |
149 | { | 149 | { |
150 | /* | ||
151 | * Make sure all delayed rcu free inodes are flushed before we | ||
152 | * destroy cache. | ||
153 | */ | ||
154 | rcu_barrier(); | ||
150 | kmem_cache_destroy(affs_inode_cachep); | 155 | kmem_cache_destroy(affs_inode_cachep); |
151 | } | 156 | } |
152 | 157 | ||
@@ -188,7 +193,7 @@ static const match_table_t tokens = { | |||
188 | }; | 193 | }; |
189 | 194 | ||
190 | static int | 195 | static int |
191 | parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s32 *root, | 196 | parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved, s32 *root, |
192 | int *blocksize, char **prefix, char *volume, unsigned long *mount_opts) | 197 | int *blocksize, char **prefix, char *volume, unsigned long *mount_opts) |
193 | { | 198 | { |
194 | char *p; | 199 | char *p; |
@@ -253,13 +258,17 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s | |||
253 | case Opt_setgid: | 258 | case Opt_setgid: |
254 | if (match_int(&args[0], &option)) | 259 | if (match_int(&args[0], &option)) |
255 | return 0; | 260 | return 0; |
256 | *gid = option; | 261 | *gid = make_kgid(current_user_ns(), option); |
262 | if (!gid_valid(*gid)) | ||
263 | return 0; | ||
257 | *mount_opts |= SF_SETGID; | 264 | *mount_opts |= SF_SETGID; |
258 | break; | 265 | break; |
259 | case Opt_setuid: | 266 | case Opt_setuid: |
260 | if (match_int(&args[0], &option)) | 267 | if (match_int(&args[0], &option)) |
261 | return 0; | 268 | return 0; |
262 | *uid = option; | 269 | *uid = make_kuid(current_user_ns(), option); |
270 | if (!uid_valid(*uid)) | ||
271 | return 0; | ||
263 | *mount_opts |= SF_SETUID; | 272 | *mount_opts |= SF_SETUID; |
264 | break; | 273 | break; |
265 | case Opt_verbose: | 274 | case Opt_verbose: |
@@ -301,8 +310,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
301 | int num_bm; | 310 | int num_bm; |
302 | int i, j; | 311 | int i, j; |
303 | s32 key; | 312 | s32 key; |
304 | uid_t uid; | 313 | kuid_t uid; |
305 | gid_t gid; | 314 | kgid_t gid; |
306 | int reserved; | 315 | int reserved; |
307 | unsigned long mount_flags; | 316 | unsigned long mount_flags; |
308 | int tmp_flags; /* fix remount prototype... */ | 317 | int tmp_flags; /* fix remount prototype... */ |
@@ -527,8 +536,8 @@ affs_remount(struct super_block *sb, int *flags, char *data) | |||
527 | { | 536 | { |
528 | struct affs_sb_info *sbi = AFFS_SB(sb); | 537 | struct affs_sb_info *sbi = AFFS_SB(sb); |
529 | int blocksize; | 538 | int blocksize; |
530 | uid_t uid; | 539 | kuid_t uid; |
531 | gid_t gid; | 540 | kgid_t gid; |
532 | int mode; | 541 | int mode; |
533 | int reserved; | 542 | int reserved; |
534 | int root_block; | 543 | int root_block; |
@@ -551,7 +560,7 @@ affs_remount(struct super_block *sb, int *flags, char *data) | |||
551 | return -EINVAL; | 560 | return -EINVAL; |
552 | } | 561 | } |
553 | 562 | ||
554 | flush_delayed_work_sync(&sbi->sb_work); | 563 | flush_delayed_work(&sbi->sb_work); |
555 | replace_mount_options(sb, new_opts); | 564 | replace_mount_options(sb, new_opts); |
556 | 565 | ||
557 | sbi->s_flags = mount_flags; | 566 | sbi->s_flags = mount_flags; |