drm/radeon: integer underflow in radeon_cp_dispatch_texture()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 23 Dec 2014 09:56:49 +0000 (12:56 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 5 Jan 2015 17:10:08 +0000 (12:10 -0500)
commitdd5a74f2f982193620cfa1ef609df1ee805781d4
tree6ea42eebf713a63abc6f40492b512f54cba42d38
parent02ae7af53a451a1b0a51022c4693f5b339133e79
drm/radeon: integer underflow in radeon_cp_dispatch_texture()

The test:

if (size > RADEON_MAX_TEXTURE_SIZE) {

"size" is an integer and it's controled by the user so it can be
negative and the test can underflow.  Later we use "size" in:

dwords = size / 4;
...
RADEON_COPY_MT(buffer, data, (int)(dwords * sizeof(u32)));

It causes memory corruption to copy a negative size buffer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/radeon_state.c