Every entry with ioctls implements ->proc_ioctl_buf() now and procfs
copies the arguments in and out around pinning the entry, for 32-bit
tasks too. Remove ->proc_ioctl() and ->proc_compat_ioctl().

Signed-off-by: Christian Brauner (Amutable) <[email protected]>
---
 fs/proc/generic.c       |  7 -------
 fs/proc/inode.c         | 30 ++----------------------------
 include/linux/proc_fs.h |  4 ----
 3 files changed, 2 insertions(+), 39 deletions(-)

diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index e3ae11805c0f..b0027400ed23 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -488,13 +488,6 @@ static int pde_set_flags(struct proc_dir_entry *pde)
                        pde->flags |= PROC_ENTRY_FULL_READS;
        }
        if (proc_ops->proc_ioctl_buf) {
-               if (WARN_ON_ONCE(proc_ops->proc_ioctl))
-                       return -EINVAL;
-#ifdef CONFIG_COMPAT
-               /* 32-bit tasks go through the table as well */
-               if (WARN_ON_ONCE(proc_ops->proc_compat_ioctl))
-                       return -EINVAL;
-#endif
                /* the table says what procfs copies, see pde_ioctl_arg() */
                if (WARN_ON_ONCE(!proc_ops->proc_ioctl_args ||
                                 !proc_ops->proc_nr_ioctl_args))
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index a7ebbe334afa..75561e3f3355 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -588,14 +588,6 @@ void proc_poll_notify(struct proc_dir_entry *pde)
 }
 EXPORT_SYMBOL_GPL(proc_poll_notify);
 
-static long pde_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned 
int cmd, unsigned long arg)
-{
-       const auto ioctl = pde->proc_ops->proc_ioctl;
-       if (ioctl)
-               return ioctl(file, cmd, arg);
-       return -ENOTTY;
-}
-
 /* the table lives in proc_ops, which goes away with the entry */
 static bool pde_ioctl_arg(struct proc_dir_entry *pde, unsigned int cmd,
                          struct proc_ioctl_arg *arg)
@@ -652,38 +644,20 @@ static long pde_ioctl_buf(struct proc_dir_entry *pde, 
struct file *file,
 static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
 {
        struct proc_dir_entry *pde = PDE(file_inode(file));
-       long rv;
 
        if (pde_has_proc_ioctl_buf(pde))
                return pde_ioctl_buf(pde, file, cmd, (void __user *)arg, arg);
-       if (!pde_pin(pde))
-               return -ENOTTY;
-       rv = pde_ioctl(pde, file, cmd, arg);
-       pde_unpin(pde);
-       return rv;
-}
-
-#ifdef CONFIG_COMPAT
-static long pde_compat_ioctl(struct proc_dir_entry *pde, struct file *file, 
unsigned int cmd, unsigned long arg)
-{
-       const auto compat_ioctl = pde->proc_ops->proc_compat_ioctl;
-       if (compat_ioctl)
-               return compat_ioctl(file, cmd, arg);
        return -ENOTTY;
 }
 
+#ifdef CONFIG_COMPAT
 static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
 {
        struct proc_dir_entry *pde = PDE(file_inode(file));
-       long rv;
 
        if (pde_has_proc_ioctl_buf(pde))
                return pde_ioctl_buf(pde, file, cmd, compat_ptr(arg), arg);
-       if (!pde_pin(pde))
-               return -ENOTTY;
-       rv = pde_compat_ioctl(pde, file, cmd, arg);
-       pde_unpin(pde);
-       return rv;
+       return -ENOTTY;
 }
 #else
 #define proc_reg_compat_ioctl NULL
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 8c406f4d09a5..f1ac112aa0fc 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -90,10 +90,6 @@ struct proc_ops {
         * entry reports EPOLLERR | EPOLLPRI.
         */
        __poll_t (*proc_poll)(struct file *, struct poll_table_struct *);
-       long    (*proc_ioctl)(struct file *, unsigned int, unsigned long);
-#ifdef CONFIG_COMPAT
-       long    (*proc_compat_ioctl)(struct file *, unsigned int, unsigned 
long);
-#endif
        /*
         * procfs pins the entry around ->proc_mmap() and wraps the
         * vm_operations of the mapping so that ->open(), ->fault(),

-- 
2.53.0


Reply via email to