]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915/dsi: double check element parsing against size if present
authorJani Nikula <jani.nikula@intel.com>
Mon, 19 Sep 2016 12:02:30 +0000 (15:02 +0300)
committerJani Nikula <jani.nikula@intel.com>
Mon, 19 Sep 2016 15:38:11 +0000 (18:38 +0300)
Be a little paranoid in case the specs change or something.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/27050d48d0ff3d58e79fcacc41ced4c071b01424.1474286487.git.jani.nikula@intel.com
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c

index 24953f9f7e1db79aef923fd331673971592d6d82..9f279a3d0f745e44179d00b056903d7de3d62f6b 100644 (file)
@@ -441,7 +441,15 @@ static void generic_exec_sequence(struct drm_panel *panel, enum mipi_seq seq_id)
                        operation_size = *data++;
 
                if (mipi_elem_exec) {
+                       const u8 *next = data + operation_size;
+
                        data = mipi_elem_exec(intel_dsi, data);
+
+                       /* Consistency check if we have size. */
+                       if (operation_size && data != next) {
+                               DRM_ERROR("Inconsistent operation size\n");
+                               return;
+                       }
                } else if (operation_size) {
                        /* We have size, skip. */
                        DRM_DEBUG_KMS("Unsupported MIPI operation byte %u\n",