Skip to content

Commit 3dd8f7c

Browse files
raven-autorvalds
authored andcommitted
autofs: make dev ioctl version and ismountpoint user accessible
Some of the autofs miscellaneous device ioctls need to be accessable to user space applications without CAP_SYS_ADMIN to get information about autofs mounts. Link: http://lkml.kernel.org/r/150216642517.11652.2338933266137331637.stgit@pluto.themaw.net Signed-off-by: Ian Kent <raven@themaw.net> Cc: Colin Walters <walters@redhat.com> Cc: Ondrej Holy <oholy@redhat.com> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e54c7bc commit 3dd8f7c

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

fs/autofs4/dev-ioctl.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,10 +628,6 @@ static int _autofs_dev_ioctl(unsigned int command,
628628
ioctl_fn fn = NULL;
629629
int err = 0;
630630

631-
/* only root can play with this */
632-
if (!capable(CAP_SYS_ADMIN))
633-
return -EPERM;
634-
635631
cmd_first = _IOC_NR(AUTOFS_DEV_IOCTL_IOC_FIRST);
636632
cmd = _IOC_NR(command);
637633

@@ -640,6 +636,14 @@ static int _autofs_dev_ioctl(unsigned int command,
640636
return -ENOTTY;
641637
}
642638

639+
/* Only root can use ioctls other than AUTOFS_DEV_IOCTL_VERSION_CMD
640+
* and AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD
641+
*/
642+
if (cmd != AUTOFS_DEV_IOCTL_VERSION_CMD &&
643+
cmd != AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD &&
644+
!capable(CAP_SYS_ADMIN))
645+
return -EPERM;
646+
643647
/* Copy the parameters into kernel space. */
644648
param = copy_dev_ioctl(user);
645649
if (IS_ERR(param))

include/uapi/linux/auto_dev-ioctl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define AUTOFS_DEVICE_NAME "autofs"
1717

1818
#define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1
19-
#define AUTOFS_DEV_IOCTL_VERSION_MINOR 0
19+
#define AUTOFS_DEV_IOCTL_VERSION_MINOR 1
2020

2121
#define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl)
2222

0 commit comments

Comments
 (0)