|
@@ -628,10 +628,6 @@ static int _autofs_dev_ioctl(unsigned int command,
|
|
|
ioctl_fn fn = NULL;
|
|
|
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 = _IOC_NR(command);
|
|
|
|
|
@@ -640,6 +636,14 @@ static int _autofs_dev_ioctl(unsigned int command,
|
|
|
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. */
|
|
|
param = copy_dev_ioctl(user);
|
|
|
if (IS_ERR(param))
|