Commit 3dd8f7c3 authored by Ian Kent's avatar Ian Kent Committed by Linus Torvalds

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.netSigned-off-by: default avatarIan 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e54c7bcb
...@@ -628,10 +628,6 @@ static int _autofs_dev_ioctl(unsigned int command, ...@@ -628,10 +628,6 @@ static int _autofs_dev_ioctl(unsigned int command,
ioctl_fn fn = NULL; ioctl_fn fn = NULL;
int err = 0; int err = 0;
/* only root can play with this */
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
cmd_first = _IOC_NR(AUTOFS_DEV_IOCTL_IOC_FIRST); cmd_first = _IOC_NR(AUTOFS_DEV_IOCTL_IOC_FIRST);
cmd = _IOC_NR(command); cmd = _IOC_NR(command);
...@@ -640,6 +636,14 @@ static int _autofs_dev_ioctl(unsigned int command, ...@@ -640,6 +636,14 @@ static int _autofs_dev_ioctl(unsigned int command,
return -ENOTTY; return -ENOTTY;
} }
/* Only root can use ioctls other than AUTOFS_DEV_IOCTL_VERSION_CMD
* and AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD
*/
if (cmd != AUTOFS_DEV_IOCTL_VERSION_CMD &&
cmd != AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD &&
!capable(CAP_SYS_ADMIN))
return -EPERM;
/* Copy the parameters into kernel space. */ /* Copy the parameters into kernel space. */
param = copy_dev_ioctl(user); param = copy_dev_ioctl(user);
if (IS_ERR(param)) if (IS_ERR(param))
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define AUTOFS_DEVICE_NAME "autofs" #define AUTOFS_DEVICE_NAME "autofs"
#define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1 #define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1
#define AUTOFS_DEV_IOCTL_VERSION_MINOR 0 #define AUTOFS_DEV_IOCTL_VERSION_MINOR 1
#define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl) #define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment