summaryrefslogtreecommitdiffstats
path: root/fs/autofs/dev-ioctl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-01-05 12:16:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-01-05 12:16:18 -0500
commita65981109f294ba7e64b33ad3b4575a4636fce66 (patch)
tree1061a49f11544e18775630938a8bc53920fa0421 /fs/autofs/dev-ioctl.c
parent3fed6ae4b027f9c93be18520f87bd06bdffd196b (diff)
parentb685a7350ae76bc0f388e24b36d06a63776c68ee (diff)
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton: - procfs updates - various misc bits - lib/ updates - epoll updates - autofs - fatfs - a few more MM bits * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (58 commits) mm/page_io.c: fix polled swap page in checkpatch: add Co-developed-by to signature tags docs: fix Co-Developed-by docs drivers/base/platform.c: kmemleak ignore a known leak fs: don't open code lru_to_page() fs/: remove caller signal_pending branch predictions mm/: remove caller signal_pending branch predictions arch/arc/mm/fault.c: remove caller signal_pending_branch predictions kernel/sched/: remove caller signal_pending branch predictions kernel/locking/mutex.c: remove caller signal_pending branch predictions mm: select HAVE_MOVE_PMD on x86 for faster mremap mm: speed up mremap by 20x on large regions mm: treewide: remove unused address argument from pte_alloc functions initramfs: cleanup incomplete rootfs scripts/gdb: fix lx-version string output kernel/kcov.c: mark write_comp_data() as notrace kernel/sysctl: add panic_print into sysctl panic: add options to print system info when panic happens bfs: extra sanity checking and static inode bitmap exec: separate MM_ANONPAGES and RLIMIT_STACK accounting ...
Diffstat (limited to 'fs/autofs/dev-ioctl.c')
-rw-r--r--fs/autofs/dev-ioctl.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/fs/autofs/dev-ioctl.c b/fs/autofs/dev-ioctl.c
index 86eafda4a652..e9fe74d1541b 100644
--- a/fs/autofs/dev-ioctl.c
+++ b/fs/autofs/dev-ioctl.c
@@ -151,22 +151,6 @@ out:
151 return err; 151 return err;
152} 152}
153 153
154/*
155 * Get the autofs super block info struct from the file opened on
156 * the autofs mount point.
157 */
158static struct autofs_sb_info *autofs_dev_ioctl_sbi(struct file *f)
159{
160 struct autofs_sb_info *sbi = NULL;
161 struct inode *inode;
162
163 if (f) {
164 inode = file_inode(f);
165 sbi = autofs_sbi(inode->i_sb);
166 }
167 return sbi;
168}
169
170/* Return autofs dev ioctl version */ 154/* Return autofs dev ioctl version */
171static int autofs_dev_ioctl_version(struct file *fp, 155static int autofs_dev_ioctl_version(struct file *fp,
172 struct autofs_sb_info *sbi, 156 struct autofs_sb_info *sbi,
@@ -366,7 +350,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
366 pipefd = param->setpipefd.pipefd; 350 pipefd = param->setpipefd.pipefd;
367 351
368 mutex_lock(&sbi->wq_mutex); 352 mutex_lock(&sbi->wq_mutex);
369 if (!sbi->catatonic) { 353 if (!(sbi->flags & AUTOFS_SBI_CATATONIC)) {
370 mutex_unlock(&sbi->wq_mutex); 354 mutex_unlock(&sbi->wq_mutex);
371 return -EBUSY; 355 return -EBUSY;
372 } else { 356 } else {
@@ -393,7 +377,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
393 swap(sbi->oz_pgrp, new_pid); 377 swap(sbi->oz_pgrp, new_pid);
394 sbi->pipefd = pipefd; 378 sbi->pipefd = pipefd;
395 sbi->pipe = pipe; 379 sbi->pipe = pipe;
396 sbi->catatonic = 0; 380 sbi->flags &= ~AUTOFS_SBI_CATATONIC;
397 } 381 }
398out: 382out:
399 put_pid(new_pid); 383 put_pid(new_pid);
@@ -658,6 +642,8 @@ static int _autofs_dev_ioctl(unsigned int command,
658 if (cmd != AUTOFS_DEV_IOCTL_VERSION_CMD && 642 if (cmd != AUTOFS_DEV_IOCTL_VERSION_CMD &&
659 cmd != AUTOFS_DEV_IOCTL_OPENMOUNT_CMD && 643 cmd != AUTOFS_DEV_IOCTL_OPENMOUNT_CMD &&
660 cmd != AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD) { 644 cmd != AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD) {
645 struct super_block *sb;
646
661 fp = fget(param->ioctlfd); 647 fp = fget(param->ioctlfd);
662 if (!fp) { 648 if (!fp) {
663 if (cmd == AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD) 649 if (cmd == AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD)
@@ -666,12 +652,13 @@ static int _autofs_dev_ioctl(unsigned int command,
666 goto out; 652 goto out;
667 } 653 }
668 654
669 sbi = autofs_dev_ioctl_sbi(fp); 655 sb = file_inode(fp)->i_sb;
670 if (!sbi || sbi->magic != AUTOFS_SBI_MAGIC) { 656 if (sb->s_type != &autofs_fs_type) {
671 err = -EINVAL; 657 err = -EINVAL;
672 fput(fp); 658 fput(fp);
673 goto out; 659 goto out;
674 } 660 }
661 sbi = autofs_sbi(sb);
675 662
676 /* 663 /*
677 * Admin needs to be able to set the mount catatonic in 664 * Admin needs to be able to set the mount catatonic in