MLK-14473: hdmi: Fix ioctl implementation
authorRobert Chiras <robert.chiras@nxp.com>
Thu, 16 Mar 2017 10:15:50 +0000 (12:15 +0200)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:21:43 +0000 (15:21 -0500)
The function mxc_hdmi_ioctl is passing kernel memory to user-space. The
case for HDMI_IOC_GET_CPU_TYPE is passing the memory directly, which is
not permitted. Fixed this, by using put_user().

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
drivers/video/fbdev/mxc/mxc_hdmi.c

index 513ab16..830d518 100644 (file)
@@ -2733,13 +2733,14 @@ static long mxc_hdmi_ioctl(struct file *file,
                                sizeof(g_hdmi->hdmi_data)) ? -EFAULT : 0;
                break;
        case HDMI_IOC_GET_CPU_TYPE:
-               *argp = g_hdmi->cpu_type;
+               ret = put_user(g_hdmi->cpu_type, argp);
                break;
        default:
                pr_debug("Unsupport cmd %d\n", cmd);
                break;
-     }
-     return ret;
+       }
+
+       return ret;
 }
 
 static int mxc_hdmi_release(struct inode *inode, struct file *file)