Skip to content

Commit 7c4eaca

Browse files
Jakob Bornecrantzairlied
authored andcommitted
drm: Check for invalid cursor flags
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
1 parent 22f5d11 commit 7c4eaca

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎drivers/gpu/drm/drm_crtc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,
19811981
if (!drm_core_check_feature(dev, DRIVER_MODESET))
19821982
return -EINVAL;
19831983

1984-
if (!req->flags)
1984+
if (!req->flags || (~DRM_MODE_CURSOR_FLAGS & req->flags))
19851985
return -EINVAL;
19861986

19871987
mutex_lock(&dev->mode_config.mutex);

‎include/drm/drm_mode.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,9 @@ struct drm_mode_mode_cmd {
359359
struct drm_mode_modeinfo mode;
360360
};
361361

362-
#define DRM_MODE_CURSOR_BO (1<<0)
363-
#define DRM_MODE_CURSOR_MOVE (1<<1)
362+
#define DRM_MODE_CURSOR_BO 0x01
363+
#define DRM_MODE_CURSOR_MOVE 0x02
364+
#define DRM_MODE_CURSOR_FLAGS 0x03
364365

365366
/*
366367
* depending on the value in flags different members are used.

0 commit comments

Comments
 (0)