x86/mcelog: Add compat_ioctl for 32-bit mcelog support
authorHe Zhe <zhe.he@windriver.com>
Wed, 4 Mar 2020 06:39:07 +0000 (14:39 +0800)
committerBorislav Petkov <bp@suse.de>
Mon, 4 May 2020 08:07:04 +0000 (10:07 +0200)
A 32-bit version of mcelog issuing ioctls on /dev/mcelog causes errors
like the following:

  MCE_GET_RECORD_LEN: Inappropriate ioctl for device

This is due to a missing compat_ioctl callback.

Assign to it compat_ptr_ioctl() as a generic implementation of the
.compat_ioctl file operation to ioctl functions that either ignore the
argument or pass a pointer to a compatible data type.

 [ bp: Massage commit message. ]

Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/1583303947-49858-1-git-send-email-zhe.he@windriver.com
arch/x86/kernel/cpu/mce/dev-mcelog.c

index c033e7ea9e3c3704805eebf3b7981164ce00e7e4..a4fd5287f02f060dc7be39e2e64c0348057acc5a 100644 (file)
@@ -329,6 +329,7 @@ static const struct file_operations mce_chrdev_ops = {
        .write                  = mce_chrdev_write,
        .poll                   = mce_chrdev_poll,
        .unlocked_ioctl         = mce_chrdev_ioctl,
+       .compat_ioctl           = compat_ptr_ioctl,
        .llseek                 = no_llseek,
 };