Commit 718b5406 authored by Michel Dänzer's avatar Michel Dänzer Committed by Alex Deucher

drm: Use kvzalloc for allocating blob property memory

The property size may be controlled by userspace, can be large (I've
seen failure with order 4, i.e. 16 pages / 64 KB) and doesn't need to be
physically contiguous.
Signed-off-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180629142710.2069-1-michel@daenzer.net
Cc: stable@vger.kernel.org
parent 021c9179
...@@ -532,7 +532,7 @@ static void drm_property_free_blob(struct kref *kref) ...@@ -532,7 +532,7 @@ static void drm_property_free_blob(struct kref *kref)
drm_mode_object_unregister(blob->dev, &blob->base); drm_mode_object_unregister(blob->dev, &blob->base);
kfree(blob); kvfree(blob);
} }
/** /**
...@@ -559,7 +559,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length, ...@@ -559,7 +559,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob)) if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL); blob = kvzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
if (!blob) if (!blob)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -576,7 +576,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length, ...@@ -576,7 +576,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
ret = __drm_mode_object_add(dev, &blob->base, DRM_MODE_OBJECT_BLOB, ret = __drm_mode_object_add(dev, &blob->base, DRM_MODE_OBJECT_BLOB,
true, drm_property_free_blob); true, drm_property_free_blob);
if (ret) { if (ret) {
kfree(blob); kvfree(blob);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment