projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8e5e83a
)
drm: Check property/enum name length
author
Ville Syrjälä
<
[email protected]
>
Fri, 2 Mar 2018 14:03:00 +0000
(16:03 +0200)
committer
Ville Syrjälä
<
[email protected]
>
Tue, 6 Mar 2018 16:03:02 +0000
(18:03 +0200)
Reject requests to add properties/enums with an overly long name.
Previously we would have just silently truncated the string and exposed
it userspace.
v2: drm_property_create() returns a pointer
Signed-off-by: Ville Syrjälä <
[email protected]
>
Link:
https://patchwork.freedesktop.org/patch/msgid/
[email protected]
Reviewed-by: Daniel Vetter <
[email protected]
>
drivers/gpu/drm/drm_property.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/drm_property.c
b/drivers/gpu/drm/drm_property.c
index fe8627fb7ae6c80ea678668eb8a0c6bbac717b4f..c37ac41125b536b7d9d27a829af2d06c6dd871ab 100644
(file)
--- a/
drivers/gpu/drm/drm_property.c
+++ b/
drivers/gpu/drm/drm_property.c
@@
-78,6
+78,9
@@
struct drm_property *drm_property_create(struct drm_device *dev, int flags,
struct drm_property *property = NULL;
int ret;
+ if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
+ return NULL;
+
property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
if (!property)
return NULL;
@@
-372,6
+375,9
@@
int drm_property_add_enum(struct drm_property *property, int index,
{
struct drm_property_enum *prop_enum;
+ if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
+ return -EINVAL;
+
if (!(drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
return -EINVAL;