Commit e88141bd authored by Dave Jones's avatar Dave Jones

[PATCH] R128 DRI limits checking.

This got fixed in 2.4, but somehow got missed in 2.6.
parent c5d9af3e
...@@ -915,6 +915,9 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev, ...@@ -915,6 +915,9 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev,
DRM_DEBUG( "\n" ); DRM_DEBUG( "\n" );
count = depth->n; count = depth->n;
if (count > 4096 || count <= 0)
return -EMSGSIZE;
if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) { if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) {
return DRM_ERR(EFAULT); return DRM_ERR(EFAULT);
} }
...@@ -1008,6 +1011,8 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev, ...@@ -1008,6 +1011,8 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
DRM_DEBUG( "\n" ); DRM_DEBUG( "\n" );
count = depth->n; count = depth->n;
if (count > 4096 || count <= 0)
return -EMSGSIZE;
xbuf_size = count * sizeof(*x); xbuf_size = count * sizeof(*x);
ybuf_size = count * sizeof(*y); ybuf_size = count * sizeof(*y);
...@@ -1125,6 +1130,9 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev, ...@@ -1125,6 +1130,9 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev,
DRM_DEBUG( "\n" ); DRM_DEBUG( "\n" );
count = depth->n; count = depth->n;
if (count > 4096 || count <= 0)
return -EMSGSIZE;
if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) { if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) {
return DRM_ERR(EFAULT); return DRM_ERR(EFAULT);
} }
...@@ -1167,6 +1175,9 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev, ...@@ -1167,6 +1175,9 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev,
DRM_DEBUG( "%s\n", __FUNCTION__ ); DRM_DEBUG( "%s\n", __FUNCTION__ );
count = depth->n; count = depth->n;
if (count > 4096 || count <= 0)
return -EMSGSIZE;
if ( count > dev_priv->depth_pitch ) { if ( count > dev_priv->depth_pitch ) {
count = dev_priv->depth_pitch; count = dev_priv->depth_pitch;
} }
......
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