aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/autofs/inode.c29
-rw-r--r--fs/autofs/root.c77
-rw-r--r--fs/autofs4/inode.c16
-rw-r--r--fs/autofs4/root.c18
4 files changed, 70 insertions, 70 deletions
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index aa0b61ff827..d8315e61731 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -34,12 +34,12 @@ void autofs_kill_sb(struct super_block *sb)
34 if (!sbi) 34 if (!sbi)
35 goto out_kill_sb; 35 goto out_kill_sb;
36 36
37 if ( !sbi->catatonic ) 37 if (!sbi->catatonic)
38 autofs_catatonic_mode(sbi); /* Free wait queues, close pipe */ 38 autofs_catatonic_mode(sbi); /* Free wait queues, close pipe */
39 39
40 autofs_hash_nuke(sbi); 40 autofs_hash_nuke(sbi);
41 for ( n = 0 ; n < AUTOFS_MAX_SYMLINKS ; n++ ) { 41 for (n = 0; n < AUTOFS_MAX_SYMLINKS; n++) {
42 if ( test_bit(n, sbi->symlink_bitmap) ) 42 if (test_bit(n, sbi->symlink_bitmap))
43 kfree(sbi->symlink[n].data); 43 kfree(sbi->symlink[n].data);
44 } 44 }
45 45
@@ -69,7 +69,8 @@ static match_table_t autofs_tokens = {
69 {Opt_err, NULL} 69 {Opt_err, NULL}
70}; 70};
71 71
72static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, pid_t *pgrp, int *minproto, int *maxproto) 72static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid,
73 pid_t *pgrp, int *minproto, int *maxproto)
73{ 74{
74 char *p; 75 char *p;
75 substring_t args[MAX_OPT_ARGS]; 76 substring_t args[MAX_OPT_ARGS];
@@ -140,7 +141,7 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
140 int minproto, maxproto; 141 int minproto, maxproto;
141 142
142 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 143 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
143 if ( !sbi ) 144 if (!sbi)
144 goto fail_unlock; 145 goto fail_unlock;
145 DPRINTK(("autofs: starting up, sbi = %p\n",sbi)); 146 DPRINTK(("autofs: starting up, sbi = %p\n",sbi));
146 147
@@ -169,14 +170,16 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
169 goto fail_iput; 170 goto fail_iput;
170 171
171 /* Can this call block? - WTF cares? s is locked. */ 172 /* Can this call block? - WTF cares? s is locked. */
172 if ( parse_options(data,&pipefd,&root_inode->i_uid,&root_inode->i_gid,&sbi->oz_pgrp,&minproto,&maxproto) ) { 173 if (parse_options(data, &pipefd, &root_inode->i_uid,
174 &root_inode->i_gid, &sbi->oz_pgrp, &minproto,
175 &maxproto)) {
173 printk("autofs: called with bogus options\n"); 176 printk("autofs: called with bogus options\n");
174 goto fail_dput; 177 goto fail_dput;
175 } 178 }
176 179
177 /* Couldn't this be tested earlier? */ 180 /* Couldn't this be tested earlier? */
178 if ( minproto > AUTOFS_PROTO_VERSION || 181 if (minproto > AUTOFS_PROTO_VERSION ||
179 maxproto < AUTOFS_PROTO_VERSION ) { 182 maxproto < AUTOFS_PROTO_VERSION) {
180 printk("autofs: kernel does not match daemon version\n"); 183 printk("autofs: kernel does not match daemon version\n");
181 goto fail_dput; 184 goto fail_dput;
182 } 185 }
@@ -184,11 +187,11 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
184 DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, sbi->oz_pgrp)); 187 DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, sbi->oz_pgrp));
185 pipe = fget(pipefd); 188 pipe = fget(pipefd);
186 189
187 if ( !pipe ) { 190 if (!pipe) {
188 printk("autofs: could not open pipe file descriptor\n"); 191 printk("autofs: could not open pipe file descriptor\n");
189 goto fail_dput; 192 goto fail_dput;
190 } 193 }
191 if ( !pipe->f_op || !pipe->f_op->write ) 194 if (!pipe->f_op || !pipe->f_op->write)
192 goto fail_fput; 195 goto fail_fput;
193 sbi->pipe = pipe; 196 sbi->pipe = pipe;
194 sbi->catatonic = 0; 197 sbi->catatonic = 0;
@@ -230,7 +233,7 @@ static void autofs_read_inode(struct inode *inode)
230 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 233 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
231 inode->i_blocks = 0; 234 inode->i_blocks = 0;
232 235
233 if ( ino == AUTOFS_ROOT_INO ) { 236 if (ino == AUTOFS_ROOT_INO) {
234 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; 237 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
235 inode->i_op = &autofs_root_inode_operations; 238 inode->i_op = &autofs_root_inode_operations;
236 inode->i_fop = &autofs_root_operations; 239 inode->i_fop = &autofs_root_operations;
@@ -241,12 +244,12 @@ static void autofs_read_inode(struct inode *inode)
241 inode->i_uid = inode->i_sb->s_root->d_inode->i_uid; 244 inode->i_uid = inode->i_sb->s_root->d_inode->i_uid;
242 inode->i_gid = inode->i_sb->s_root->d_inode->i_gid; 245 inode->i_gid = inode->i_sb->s_root->d_inode->i_gid;
243 246
244 if ( ino >= AUTOFS_FIRST_SYMLINK && ino < AUTOFS_FIRST_DIR_INO ) { 247 if (ino >= AUTOFS_FIRST_SYMLINK && ino < AUTOFS_FIRST_DIR_INO) {
245 /* Symlink inode - should be in symlink list */ 248 /* Symlink inode - should be in symlink list */
246 struct autofs_symlink *sl; 249 struct autofs_symlink *sl;
247 250
248 n = ino - AUTOFS_FIRST_SYMLINK; 251 n = ino - AUTOFS_FIRST_SYMLINK;
249 if ( n >= AUTOFS_MAX_SYMLINKS || !test_bit(n,sbi->symlink_bitmap)) { 252 if (n >= AUTOFS_MAX_SYMLINKS || !test_bit(n,sbi->symlink_bitmap)) {
250 printk("autofs: Looking for bad symlink inode %u\n", (unsigned int) ino); 253 printk("autofs: Looking for bad symlink inode %u\n", (unsigned int) ino);
251 return; 254 return;
252 } 255 }
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index f2597205939..6fa04dd6d16 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -67,8 +67,8 @@ static int autofs_root_readdir(struct file *filp, void *dirent, filldir_t filldi
67 filp->f_pos = ++nr; 67 filp->f_pos = ++nr;
68 /* fall through */ 68 /* fall through */
69 default: 69 default:
70 while ( onr = nr, ent = autofs_hash_enum(dirhash,&nr,ent) ) { 70 while (onr = nr, ent = autofs_hash_enum(dirhash,&nr,ent)) {
71 if ( !ent->dentry || d_mountpoint(ent->dentry) ) { 71 if (!ent->dentry || d_mountpoint(ent->dentry)) {
72 if (filldir(dirent,ent->name,ent->len,onr,ent->ino,DT_UNKNOWN) < 0) 72 if (filldir(dirent,ent->name,ent->len,onr,ent->ino,DT_UNKNOWN) < 0)
73 goto out; 73 goto out;
74 filp->f_pos = nr; 74 filp->f_pos = nr;
@@ -88,10 +88,10 @@ static int try_to_fill_dentry(struct dentry *dentry, struct super_block *sb, str
88 struct autofs_dir_ent *ent; 88 struct autofs_dir_ent *ent;
89 int status = 0; 89 int status = 0;
90 90
91 if ( !(ent = autofs_hash_lookup(&sbi->dirhash, &dentry->d_name)) ) { 91 if (!(ent = autofs_hash_lookup(&sbi->dirhash, &dentry->d_name))) {
92 do { 92 do {
93 if ( status && dentry->d_inode ) { 93 if (status && dentry->d_inode) {
94 if ( status != -ENOENT ) 94 if (status != -ENOENT)
95 printk("autofs warning: lookup failure on positive dentry, status = %d, name = %s\n", status, dentry->d_name.name); 95 printk("autofs warning: lookup failure on positive dentry, status = %d, name = %s\n", status, dentry->d_name.name);
96 return 0; /* Try to get the kernel to invalidate this dentry */ 96 return 0; /* Try to get the kernel to invalidate this dentry */
97 } 97 }
@@ -106,7 +106,7 @@ static int try_to_fill_dentry(struct dentry *dentry, struct super_block *sb, str
106 return 1; 106 return 1;
107 } 107 }
108 status = autofs_wait(sbi, &dentry->d_name); 108 status = autofs_wait(sbi, &dentry->d_name);
109 } while (!(ent = autofs_hash_lookup(&sbi->dirhash, &dentry->d_name)) ); 109 } while (!(ent = autofs_hash_lookup(&sbi->dirhash, &dentry->d_name)));
110 } 110 }
111 111
112 /* Abuse this field as a pointer to the directory entry, used to 112 /* Abuse this field as a pointer to the directory entry, used to
@@ -124,13 +124,13 @@ static int try_to_fill_dentry(struct dentry *dentry, struct super_block *sb, str
124 124
125 /* If this is a directory that isn't a mount point, bitch at the 125 /* If this is a directory that isn't a mount point, bitch at the
126 daemon and fix it in user space */ 126 daemon and fix it in user space */
127 if ( S_ISDIR(dentry->d_inode->i_mode) && !d_mountpoint(dentry) ) { 127 if (S_ISDIR(dentry->d_inode->i_mode) && !d_mountpoint(dentry)) {
128 return !autofs_wait(sbi, &dentry->d_name); 128 return !autofs_wait(sbi, &dentry->d_name);
129 } 129 }
130 130
131 /* We don't update the usages for the autofs daemon itself, this 131 /* We don't update the usages for the autofs daemon itself, this
132 is necessary for recursive autofs mounts */ 132 is necessary for recursive autofs mounts */
133 if ( !autofs_oz_mode(sbi) ) { 133 if (!autofs_oz_mode(sbi)) {
134 autofs_update_usage(&sbi->dirhash,ent); 134 autofs_update_usage(&sbi->dirhash,ent);
135 } 135 }
136 136
@@ -157,7 +157,7 @@ static int autofs_revalidate(struct dentry * dentry, struct nameidata *nd)
157 sbi = autofs_sbi(dir->i_sb); 157 sbi = autofs_sbi(dir->i_sb);
158 158
159 /* Pending dentry */ 159 /* Pending dentry */
160 if ( dentry->d_flags & DCACHE_AUTOFS_PENDING ) { 160 if (dentry->d_flags & DCACHE_AUTOFS_PENDING) {
161 if (autofs_oz_mode(sbi)) 161 if (autofs_oz_mode(sbi))
162 res = 1; 162 res = 1;
163 else 163 else
@@ -173,7 +173,7 @@ static int autofs_revalidate(struct dentry * dentry, struct nameidata *nd)
173 } 173 }
174 174
175 /* Check for a non-mountpoint directory */ 175 /* Check for a non-mountpoint directory */
176 if ( S_ISDIR(dentry->d_inode->i_mode) && !d_mountpoint(dentry) ) { 176 if (S_ISDIR(dentry->d_inode->i_mode) && !d_mountpoint(dentry)) {
177 if (autofs_oz_mode(sbi)) 177 if (autofs_oz_mode(sbi))
178 res = 1; 178 res = 1;
179 else 179 else
@@ -183,9 +183,9 @@ static int autofs_revalidate(struct dentry * dentry, struct nameidata *nd)
183 } 183 }
184 184
185 /* Update the usage list */ 185 /* Update the usage list */
186 if ( !autofs_oz_mode(sbi) ) { 186 if (!autofs_oz_mode(sbi)) {
187 ent = (struct autofs_dir_ent *) dentry->d_time; 187 ent = (struct autofs_dir_ent *) dentry->d_time;
188 if ( ent ) 188 if (ent)
189 autofs_update_usage(&sbi->dirhash,ent); 189 autofs_update_usage(&sbi->dirhash,ent);
190 } 190 }
191 unlock_kernel(); 191 unlock_kernel();
@@ -258,7 +258,7 @@ static struct dentry *autofs_root_lookup(struct inode *dir, struct dentry *dentr
258 * doesn't do the right thing for all system calls, but it should 258 * doesn't do the right thing for all system calls, but it should
259 * be OK for the operations we permit from an autofs. 259 * be OK for the operations we permit from an autofs.
260 */ 260 */
261 if ( dentry->d_inode && d_unhashed(dentry) ) 261 if (dentry->d_inode && d_unhashed(dentry))
262 return ERR_PTR(-ENOENT); 262 return ERR_PTR(-ENOENT);
263 263
264 return NULL; 264 return NULL;
@@ -277,18 +277,18 @@ static int autofs_root_symlink(struct inode *dir, struct dentry *dentry, const c
277 autofs_say(dentry->d_name.name,dentry->d_name.len); 277 autofs_say(dentry->d_name.name,dentry->d_name.len);
278 278
279 lock_kernel(); 279 lock_kernel();
280 if ( !autofs_oz_mode(sbi) ) { 280 if (!autofs_oz_mode(sbi)) {
281 unlock_kernel(); 281 unlock_kernel();
282 return -EACCES; 282 return -EACCES;
283 } 283 }
284 284
285 if ( autofs_hash_lookup(dh, &dentry->d_name) ) { 285 if (autofs_hash_lookup(dh, &dentry->d_name)) {
286 unlock_kernel(); 286 unlock_kernel();
287 return -EEXIST; 287 return -EEXIST;
288 } 288 }
289 289
290 n = find_first_zero_bit(sbi->symlink_bitmap,AUTOFS_MAX_SYMLINKS); 290 n = find_first_zero_bit(sbi->symlink_bitmap,AUTOFS_MAX_SYMLINKS);
291 if ( n >= AUTOFS_MAX_SYMLINKS ) { 291 if (n >= AUTOFS_MAX_SYMLINKS) {
292 unlock_kernel(); 292 unlock_kernel();
293 return -ENOSPC; 293 return -ENOSPC;
294 } 294 }
@@ -297,14 +297,14 @@ static int autofs_root_symlink(struct inode *dir, struct dentry *dentry, const c
297 sl = &sbi->symlink[n]; 297 sl = &sbi->symlink[n];
298 sl->len = strlen(symname); 298 sl->len = strlen(symname);
299 sl->data = kmalloc(slsize = sl->len+1, GFP_KERNEL); 299 sl->data = kmalloc(slsize = sl->len+1, GFP_KERNEL);
300 if ( !sl->data ) { 300 if (!sl->data) {
301 clear_bit(n,sbi->symlink_bitmap); 301 clear_bit(n,sbi->symlink_bitmap);
302 unlock_kernel(); 302 unlock_kernel();
303 return -ENOSPC; 303 return -ENOSPC;
304 } 304 }
305 305
306 ent = kmalloc(sizeof(struct autofs_dir_ent), GFP_KERNEL); 306 ent = kmalloc(sizeof(struct autofs_dir_ent), GFP_KERNEL);
307 if ( !ent ) { 307 if (!ent) {
308 kfree(sl->data); 308 kfree(sl->data);
309 clear_bit(n,sbi->symlink_bitmap); 309 clear_bit(n,sbi->symlink_bitmap);
310 unlock_kernel(); 310 unlock_kernel();
@@ -312,7 +312,7 @@ static int autofs_root_symlink(struct inode *dir, struct dentry *dentry, const c
312 } 312 }
313 313
314 ent->name = kmalloc(dentry->d_name.len+1, GFP_KERNEL); 314 ent->name = kmalloc(dentry->d_name.len+1, GFP_KERNEL);
315 if ( !ent->name ) { 315 if (!ent->name) {
316 kfree(sl->data); 316 kfree(sl->data);
317 kfree(ent); 317 kfree(ent);
318 clear_bit(n,sbi->symlink_bitmap); 318 clear_bit(n,sbi->symlink_bitmap);
@@ -354,23 +354,23 @@ static int autofs_root_unlink(struct inode *dir, struct dentry *dentry)
354 354
355 /* This allows root to remove symlinks */ 355 /* This allows root to remove symlinks */
356 lock_kernel(); 356 lock_kernel();
357 if ( !autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) ) { 357 if (!autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) {
358 unlock_kernel(); 358 unlock_kernel();
359 return -EACCES; 359 return -EACCES;
360 } 360 }
361 361
362 ent = autofs_hash_lookup(dh, &dentry->d_name); 362 ent = autofs_hash_lookup(dh, &dentry->d_name);
363 if ( !ent ) { 363 if (!ent) {
364 unlock_kernel(); 364 unlock_kernel();
365 return -ENOENT; 365 return -ENOENT;
366 } 366 }
367 367
368 n = ent->ino - AUTOFS_FIRST_SYMLINK; 368 n = ent->ino - AUTOFS_FIRST_SYMLINK;
369 if ( n >= AUTOFS_MAX_SYMLINKS ) { 369 if (n >= AUTOFS_MAX_SYMLINKS) {
370 unlock_kernel(); 370 unlock_kernel();
371 return -EISDIR; /* It's a directory, dummy */ 371 return -EISDIR; /* It's a directory, dummy */
372 } 372 }
373 if ( !test_bit(n,sbi->symlink_bitmap) ) { 373 if (!test_bit(n,sbi->symlink_bitmap)) {
374 unlock_kernel(); 374 unlock_kernel();
375 return -EINVAL; /* Nonexistent symlink? Shouldn't happen */ 375 return -EINVAL; /* Nonexistent symlink? Shouldn't happen */
376 } 376 }
@@ -392,23 +392,23 @@ static int autofs_root_rmdir(struct inode *dir, struct dentry *dentry)
392 struct autofs_dir_ent *ent; 392 struct autofs_dir_ent *ent;
393 393
394 lock_kernel(); 394 lock_kernel();
395 if ( !autofs_oz_mode(sbi) ) { 395 if (!autofs_oz_mode(sbi)) {
396 unlock_kernel(); 396 unlock_kernel();
397 return -EACCES; 397 return -EACCES;
398 } 398 }
399 399
400 ent = autofs_hash_lookup(dh, &dentry->d_name); 400 ent = autofs_hash_lookup(dh, &dentry->d_name);
401 if ( !ent ) { 401 if (!ent) {
402 unlock_kernel(); 402 unlock_kernel();
403 return -ENOENT; 403 return -ENOENT;
404 } 404 }
405 405
406 if ( (unsigned int)ent->ino < AUTOFS_FIRST_DIR_INO ) { 406 if ((unsigned int)ent->ino < AUTOFS_FIRST_DIR_INO) {
407 unlock_kernel(); 407 unlock_kernel();
408 return -ENOTDIR; /* Not a directory */ 408 return -ENOTDIR; /* Not a directory */
409 } 409 }
410 410
411 if ( ent->dentry != dentry ) { 411 if (ent->dentry != dentry) {
412 printk("autofs_rmdir: odentry != dentry for entry %s\n", dentry->d_name.name); 412 printk("autofs_rmdir: odentry != dentry for entry %s\n", dentry->d_name.name);
413 } 413 }
414 414
@@ -429,18 +429,18 @@ static int autofs_root_mkdir(struct inode *dir, struct dentry *dentry, int mode)
429 ino_t ino; 429 ino_t ino;
430 430
431 lock_kernel(); 431 lock_kernel();
432 if ( !autofs_oz_mode(sbi) ) { 432 if (!autofs_oz_mode(sbi)) {
433 unlock_kernel(); 433 unlock_kernel();
434 return -EACCES; 434 return -EACCES;
435 } 435 }
436 436
437 ent = autofs_hash_lookup(dh, &dentry->d_name); 437 ent = autofs_hash_lookup(dh, &dentry->d_name);
438 if ( ent ) { 438 if (ent) {
439 unlock_kernel(); 439 unlock_kernel();
440 return -EEXIST; 440 return -EEXIST;
441 } 441 }
442 442
443 if ( sbi->next_dir_ino < AUTOFS_FIRST_DIR_INO ) { 443 if (sbi->next_dir_ino < AUTOFS_FIRST_DIR_INO) {
444 printk("autofs: Out of inode numbers -- what the heck did you do??\n"); 444 printk("autofs: Out of inode numbers -- what the heck did you do??\n");
445 unlock_kernel(); 445 unlock_kernel();
446 return -ENOSPC; 446 return -ENOSPC;
@@ -448,13 +448,13 @@ static int autofs_root_mkdir(struct inode *dir, struct dentry *dentry, int mode)
448 ino = sbi->next_dir_ino++; 448 ino = sbi->next_dir_ino++;
449 449
450 ent = kmalloc(sizeof(struct autofs_dir_ent), GFP_KERNEL); 450 ent = kmalloc(sizeof(struct autofs_dir_ent), GFP_KERNEL);
451 if ( !ent ) { 451 if (!ent) {
452 unlock_kernel(); 452 unlock_kernel();
453 return -ENOSPC; 453 return -ENOSPC;
454 } 454 }
455 455
456 ent->name = kmalloc(dentry->d_name.len+1, GFP_KERNEL); 456 ent->name = kmalloc(dentry->d_name.len+1, GFP_KERNEL);
457 if ( !ent->name ) { 457 if (!ent->name) {
458 kfree(ent); 458 kfree(ent);
459 unlock_kernel(); 459 unlock_kernel();
460 return -ENOSPC; 460 return -ENOSPC;
@@ -483,7 +483,7 @@ static inline int autofs_get_set_timeout(struct autofs_sb_info *sbi,
483 put_user(sbi->exp_timeout / HZ, p)) 483 put_user(sbi->exp_timeout / HZ, p))
484 return -EFAULT; 484 return -EFAULT;
485 485
486 if ( ntimeout > ULONG_MAX/HZ ) 486 if (ntimeout > ULONG_MAX/HZ)
487 sbi->exp_timeout = 0; 487 sbi->exp_timeout = 0;
488 else 488 else
489 sbi->exp_timeout = ntimeout * HZ; 489 sbi->exp_timeout = ntimeout * HZ;
@@ -511,15 +511,14 @@ static inline int autofs_expire_run(struct super_block *sb,
511 pkt.hdr.proto_version = AUTOFS_PROTO_VERSION; 511 pkt.hdr.proto_version = AUTOFS_PROTO_VERSION;
512 pkt.hdr.type = autofs_ptype_expire; 512 pkt.hdr.type = autofs_ptype_expire;
513 513
514 if ( !sbi->exp_timeout || 514 if (!sbi->exp_timeout || !(ent = autofs_expire(sb,sbi,mnt)))
515 !(ent = autofs_expire(sb,sbi,mnt)) )
516 return -EAGAIN; 515 return -EAGAIN;
517 516
518 pkt.len = ent->len; 517 pkt.len = ent->len;
519 memcpy(pkt.name, ent->name, pkt.len); 518 memcpy(pkt.name, ent->name, pkt.len);
520 pkt.name[pkt.len] = '\0'; 519 pkt.name[pkt.len] = '\0';
521 520
522 if ( copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire)) ) 521 if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire)))
523 return -EFAULT; 522 return -EFAULT;
524 523
525 return 0; 524 return 0;
@@ -537,11 +536,11 @@ static int autofs_root_ioctl(struct inode *inode, struct file *filp,
537 536
538 DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",cmd,arg,sbi,process_group(current))); 537 DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",cmd,arg,sbi,process_group(current)));
539 538
540 if ( _IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || 539 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
541 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT ) 540 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
542 return -ENOTTY; 541 return -ENOTTY;
543 542
544 if ( !autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) ) 543 if (!autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
545 return -EPERM; 544 return -EPERM;
546 545
547 switch(cmd) { 546 switch(cmd) {
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 5769a2f9ad6..692364e8ffc 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -218,8 +218,7 @@ static match_table_t tokens = {
218}; 218};
219 219
220static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid, 220static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid,
221 pid_t *pgrp, unsigned int *type, 221 pid_t *pgrp, unsigned int *type, int *minproto, int *maxproto)
222 int *minproto, int *maxproto)
223{ 222{
224 char *p; 223 char *p;
225 substring_t args[MAX_OPT_ARGS]; 224 substring_t args[MAX_OPT_ARGS];
@@ -314,7 +313,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
314 struct autofs_info *ino; 313 struct autofs_info *ino;
315 314
316 sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); 315 sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
317 if ( !sbi ) 316 if (!sbi)
318 goto fail_unlock; 317 goto fail_unlock;
319 DPRINTK("starting up, sbi = %p",sbi); 318 DPRINTK("starting up, sbi = %p",sbi);
320 319
@@ -363,10 +362,9 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
363 root->d_fsdata = ino; 362 root->d_fsdata = ino;
364 363
365 /* Can this call block? */ 364 /* Can this call block? */
366 if (parse_options(data, &pipefd, 365 if (parse_options(data, &pipefd, &root_inode->i_uid, &root_inode->i_gid,
367 &root_inode->i_uid, &root_inode->i_gid, 366 &sbi->oz_pgrp, &sbi->type, &sbi->min_proto,
368 &sbi->oz_pgrp, &sbi->type, 367 &sbi->max_proto)) {
369 &sbi->min_proto, &sbi->max_proto)) {
370 printk("autofs: called with bogus options\n"); 368 printk("autofs: called with bogus options\n");
371 goto fail_dput; 369 goto fail_dput;
372 } 370 }
@@ -396,11 +394,11 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
396 DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp); 394 DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp);
397 pipe = fget(pipefd); 395 pipe = fget(pipefd);
398 396
399 if ( !pipe ) { 397 if (!pipe) {
400 printk("autofs: could not open pipe file descriptor\n"); 398 printk("autofs: could not open pipe file descriptor\n");
401 goto fail_dput; 399 goto fail_dput;
402 } 400 }
403 if ( !pipe->f_op || !pipe->f_op->write ) 401 if (!pipe->f_op || !pipe->f_op->write)
404 goto fail_fput; 402 goto fail_fput;
405 sbi->pipe = pipe; 403 sbi->pipe = pipe;
406 sbi->pipefd = pipefd; 404 sbi->pipefd = pipefd;
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 15170f4e13a..2d4c8a3e604 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -759,7 +759,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
759 struct autofs_info *p_ino; 759 struct autofs_info *p_ino;
760 760
761 /* This allows root to remove symlinks */ 761 /* This allows root to remove symlinks */
762 if ( !autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) ) 762 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
763 return -EACCES; 763 return -EACCES;
764 764
765 if (atomic_dec_and_test(&ino->count)) { 765 if (atomic_dec_and_test(&ino->count)) {
@@ -833,7 +833,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
833 struct autofs_info *p_ino; 833 struct autofs_info *p_ino;
834 struct inode *inode; 834 struct inode *inode;
835 835
836 if ( !autofs4_oz_mode(sbi) ) 836 if (!autofs4_oz_mode(sbi))
837 return -EACCES; 837 return -EACCES;
838 838
839 DPRINTK("dentry %p, creating %.*s", 839 DPRINTK("dentry %p, creating %.*s",
@@ -871,11 +871,11 @@ static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi,
871 int rv; 871 int rv;
872 unsigned long ntimeout; 872 unsigned long ntimeout;
873 873
874 if ( (rv = get_user(ntimeout, p)) || 874 if ((rv = get_user(ntimeout, p)) ||
875 (rv = put_user(sbi->exp_timeout/HZ, p)) ) 875 (rv = put_user(sbi->exp_timeout/HZ, p)))
876 return rv; 876 return rv;
877 877
878 if ( ntimeout > ULONG_MAX/HZ ) 878 if (ntimeout > ULONG_MAX/HZ)
879 sbi->exp_timeout = 0; 879 sbi->exp_timeout = 0;
880 else 880 else
881 sbi->exp_timeout = ntimeout * HZ; 881 sbi->exp_timeout = ntimeout * HZ;
@@ -906,7 +906,7 @@ static inline int autofs4_ask_reghost(struct autofs_sb_info *sbi, int __user *p)
906 DPRINTK("returning %d", sbi->needs_reghost); 906 DPRINTK("returning %d", sbi->needs_reghost);
907 907
908 status = put_user(sbi->needs_reghost, p); 908 status = put_user(sbi->needs_reghost, p);
909 if ( status ) 909 if (status)
910 return status; 910 return status;
911 911
912 sbi->needs_reghost = 0; 912 sbi->needs_reghost = 0;
@@ -975,11 +975,11 @@ static int autofs4_root_ioctl(struct inode *inode, struct file *filp,
975 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u", 975 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
976 cmd,arg,sbi,process_group(current)); 976 cmd,arg,sbi,process_group(current));
977 977
978 if ( _IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || 978 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
979 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT ) 979 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
980 return -ENOTTY; 980 return -ENOTTY;
981 981
982 if ( !autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) ) 982 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
983 return -EPERM; 983 return -EPERM;
984 984
985 switch(cmd) { 985 switch(cmd) {