All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] drm: crtc: integer overflow in drm_property_create_blob()
@ 2015-10-29 13:37 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-10-29 13:37 UTC (permalink / raw)
  To: David Airlie; +Cc: kernel-janitors, dri-devel

The size here comes from the user via the ioctl, it is a number between
1-u32max so the addition here could overflow on 32 bit systems.

Fixes: f453ba046074 ('DRM: add mode setting support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e54660a..627b2d0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4107,7 +4107,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
 	struct drm_property_blob *blob;
 	int ret;
 
-	if (!length)
+	if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob))
 		return ERR_PTR(-EINVAL);
 
 	blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [patch] drm: crtc: integer overflow in drm_property_create_blob()
@ 2015-10-29 13:37 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-10-29 13:37 UTC (permalink / raw)
  To: David Airlie; +Cc: kernel-janitors, dri-devel

The size here comes from the user via the ioctl, it is a number between
1-u32max so the addition here could overflow on 32 bit systems.

Fixes: f453ba046074 ('DRM: add mode setting support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e54660a..627b2d0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4107,7 +4107,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
 	struct drm_property_blob *blob;
 	int ret;
 
-	if (!length)
+	if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob))
 		return ERR_PTR(-EINVAL);
 
 	blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] drm: crtc: integer overflow in drm_property_create_blob()
  2015-10-29 13:37 ` Dan Carpenter
  (?)
@ 2015-10-29 14:40 ` Daniel Stone
  -1 siblings, 0 replies; 3+ messages in thread
From: Daniel Stone @ 2015-10-29 14:40 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: David Airlie, kernel-janitors, dri-devel

Hi Dan,

On 29 October 2015 at 13:37, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> The size here comes from the user via the ioctl, it is a number between
> 1-u32max so the addition here could overflow on 32 bit systems.
>
> Fixes: f453ba046074 ('DRM: add mode setting support')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for catching this. I did have a pass through looking for such
issues but couldn't see any. :\

Reviewed-by: Daniel Stone <daniels@collabora.com>
Cc: stable@kernel.org # v4.2

Cheers,
Daniel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-29 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-29 13:37 [patch] drm: crtc: integer overflow in drm_property_create_blob() Dan Carpenter
2015-10-29 13:37 ` Dan Carpenter
2015-10-29 14:40 ` Daniel Stone

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.