Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=778f3dd5a13c9e1642e0b2efea4b769387a70afa
Commit:     778f3dd5a13c9e1642e0b2efea4b769387a70afa
Parent:     040b3a2df2dd26c3e401823f3b0ce3fe99e966c5
Author:     David Miller <[EMAIL PROTECTED]>
AuthorDate: Fri Jul 27 22:58:37 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sat Jul 28 19:42:22 2007 -0700

    Fix procfs compat_ioctl regression
    
    It is important to only provide the compat_ioctl method
    if the downstream de->proc_fops does too, otherwise this
    utterly confuses the logic in fs/compat_ioctl.c and we
    end up doing the wrong thing.
    
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
    Acked-by: Alexey Dobriyan <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/proc/inode.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 94e2c1a..a5b0dfd 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -386,6 +386,19 @@ static const struct file_operations proc_reg_file_ops = {
        .release        = proc_reg_release,
 };
 
+#ifdef CONFIG_COMPAT
+static const struct file_operations proc_reg_file_ops_no_compat = {
+       .llseek         = proc_reg_llseek,
+       .read           = proc_reg_read,
+       .write          = proc_reg_write,
+       .poll           = proc_reg_poll,
+       .unlocked_ioctl = proc_reg_unlocked_ioctl,
+       .mmap           = proc_reg_mmap,
+       .open           = proc_reg_open,
+       .release        = proc_reg_release,
+};
+#endif
+
 struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
                                struct proc_dir_entry *de)
 {
@@ -413,8 +426,15 @@ struct inode *proc_get_inode(struct super_block *sb, 
unsigned int ino,
                if (de->proc_iops)
                        inode->i_op = de->proc_iops;
                if (de->proc_fops) {
-                       if (S_ISREG(inode->i_mode))
-                               inode->i_fop = &proc_reg_file_ops;
+                       if (S_ISREG(inode->i_mode)) {
+#ifdef CONFIG_COMPAT
+                               if (!de->proc_fops->compat_ioctl)
+                                       inode->i_fop =
+                                               &proc_reg_file_ops_no_compat;
+                               else
+#endif
+                                       inode->i_fop = &proc_reg_file_ops;
+                       }
                        else
                                inode->i_fop = de->proc_fops;
                }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to