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       |  2 --
 fs/proc/inode.c         | 30 ++----------------------------
 include/linux/proc_fs.h |  4 ----
 3 files changed, 2 insertions(+), 34 deletions(-)

diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 7b2ed3c42d32..413382efefc7 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -484,8 +484,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;
                /* 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 dac5974d4652..971f2aecc006 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -551,14 +551,6 @@ static __poll_t proc_reg_poll(struct file *file, struct 
poll_table_struct *pts)
        return rv;
 }
 
-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)
@@ -615,38 +607,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 f21dd826eaa6..64242a9aa117 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -81,10 +81,6 @@ struct proc_ops {
        loff_t  (*proc_lseek)(struct file *, loff_t, int);
        int     (*proc_release)(struct inode *, struct file *);
        __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
        int     (*proc_mmap)(struct file *, struct vm_area_struct *);
        unsigned long (*proc_get_unmapped_area)(struct file *, unsigned long, 
unsigned long, unsigned long, unsigned long);
        /*

-- 
2.53.0


Reply via email to