From: Ian Kent <raven@themaw.net>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Colin Walters <walters@redhat.com>,
Ondrej Holy <oholy@redhat.com>,
autofs mailing list <autofs@vger.kernel.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>,
David Howells <dhowells@redhat.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: [PATCH 2/3] autofs - make dev ioctl version and ismountpoint user accessible
Date: Wed, 10 May 2017 12:18:43 +0800 [thread overview]
Message-ID: <149438992338.26550.10884570110596019368.stgit@pluto.themaw.net> (raw)
In-Reply-To: <149438991819.26550.11290804420751932707.stgit@pluto.themaw.net>
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.
Start by making the autofs miscellaneous device ioctl header available
and allow applications to use version and ismountpoint ioctls.
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Colin Walters <walters@redhat.com>
Cc: Ondrej Holy <oholy@redhat.com>
Cc: stable@vger.kernel.org
---
fs/autofs4/dev-ioctl.c | 12 ++++++++----
include/uapi/linux/Kbuild | 1 +
include/uapi/linux/auto_dev-ioctl.h | 2 +-
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index 9b58d6e..f8cb3f6 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -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))
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 662c592..1f22bbb 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -61,6 +61,7 @@ header-y += atm_zatm.h
header-y += audit.h
header-y += auto_fs4.h
header-y += auto_fs.h
+header-y += auto_dev-ioctl.h
header-y += auxvec.h
header-y += ax25.h
header-y += b1lli.h
diff --git a/include/uapi/linux/auto_dev-ioctl.h b/include/uapi/linux/auto_dev-ioctl.h
index 744b3d0..5558db8 100644
--- a/include/uapi/linux/auto_dev-ioctl.h
+++ b/include/uapi/linux/auto_dev-ioctl.h
@@ -16,7 +16,7 @@
#define AUTOFS_DEVICE_NAME "autofs"
#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)
next prev parent reply other threads:[~2017-05-10 4:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 4:18 [PATCH 1/3] autofs - make disc device " Ian Kent
2017-05-10 4:18 ` Ian Kent [this message]
2017-05-10 4:18 ` [PATCH 3/3] autofs - fix AT_NO_AUTOMOUNT not being honored Ian Kent
2017-05-12 12:49 ` Colin Walters
2017-11-21 1:53 ` NeilBrown
2017-11-22 4:28 ` Ian Kent
2017-11-23 0:36 ` Ian Kent
2017-11-23 2:21 ` NeilBrown
2017-11-23 2:46 ` Ian Kent
2017-11-23 3:04 ` Ian Kent
2017-11-23 4:49 ` NeilBrown
2017-11-23 6:34 ` Ian Kent
2017-11-27 16:01 ` Mike Marion
2017-11-27 23:43 ` Ian Kent
2017-11-28 0:29 ` Mike Marion
2017-11-29 1:17 ` NeilBrown
2017-11-29 2:13 ` Mike Marion
2017-11-29 2:28 ` Ian Kent
2017-11-29 2:48 ` NeilBrown
2017-11-29 3:14 ` Ian Kent
2017-11-29 2:56 ` Ian Kent
2017-11-29 3:45 ` NeilBrown
2017-11-29 6:00 ` Ian Kent
2017-11-29 7:39 ` NeilBrown
2017-11-30 0:00 ` Ian Kent
2017-11-29 16:51 ` Mike Marion
2017-11-23 0:47 ` NeilBrown
2017-11-23 1:43 ` Ian Kent
2017-11-23 2:26 ` Ian Kent
2017-11-23 3:04 ` NeilBrown
2017-11-23 3:41 ` Ian Kent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=149438992338.26550.10884570110596019368.stgit@pluto.themaw.net \
--to=raven@themaw.net \
--cc=autofs@vger.kernel.org \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oholy@redhat.com \
--cc=viro@ZenIV.linux.org.uk \
--cc=walters@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®