Skip to content

Commit a01c477

Browse files
committed
drm: Fix uabi regression by allowing garbage mode->type from userspace
Apparently xf86-video-vmware leaves the mode->type uninitialized when feeding the mode to the kernel. Thus we have no choice but to accept the garbage in. We'll just ignore any of the bits we don't want. The mode type is just a hint anyway, and more useful for the kernel->userspace direction. Reported-by: Thomas Hellstrom <thomas@shipmail.org> CC: Thomas Hellstrom <thomas@shipmail.org> Cc: Adam Jackson <ajax@redhat.com> Cc: Alex Deucher <alexander.deucher@amd.com> Fixes: c6ed6da ("drm/uapi: Validate the mode flags/type") References: https://lists.freedesktop.org/archives/dri-devel/2018-March/170213.html Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180321211246.10152-1-ville.syrjala@linux.intel.com Tested-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
1 parent 1c7095d commit a01c477

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/gpu/drm/drm_modes.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,13 @@ int drm_mode_convert_umode(struct drm_device *dev,
16111611
out->vscan = in->vscan;
16121612
out->vrefresh = in->vrefresh;
16131613
out->flags = in->flags;
1614-
out->type = in->type;
1614+
/*
1615+
* Old xf86-video-vmware (possibly others too) used to
1616+
* leave 'type' unititialized. Just ignore any bits we
1617+
* don't like. It's a just hint after all, and more
1618+
* useful for the kernel->userspace direction anyway.
1619+
*/
1620+
out->type = in->type & DRM_MODE_TYPE_ALL;
16151621
strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
16161622
out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
16171623

0 commit comments

Comments
 (0)