Skip to contentSkip to conversation

drm/radeon: check incoming cliprects pointer

PATCH RESEND In review Kees Cook 2 participants 2 messages May 13, 2013

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH RESEND 1/1 drm/radeon: check incoming cliprects pointer

The "boxes" parameter points into userspace memory. It should be verified like any other operation against user memory.

---
 drivers/gpu/drm/radeon/r300_cmdbuf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/r300_cmdbuf.c +1 -1
index 865e2c9..60170ea 100644
@@ -75,7 +75,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
 		OUT_RING(CP_PACKET0(R300_RE_CLIPRECT_TL_0, nr * 2 - 1));
 
 		for (i = 0; i < nr; ++i) {
-			if (DRM_COPY_FROM_USER_UNCHECKED
+			if (DRM_COPY_FROM_USER
 			    (&box, &cmdbuf->boxes[n + i], sizeof(box))) {
 				DRM_ERROR("copy cliprect faulted\n");
 				return -EFAULT;
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
#1 lore raw
Quoted 5 lines · Kees Cook

The "boxes" parameter points into userspace memory. It should be verified like any other operation against user memory.

Thanks. Applied.

Alex

Quoted 28 lines
---
 drivers/gpu/drm/radeon/r300_cmdbuf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/r300_cmdbuf.c +1 -2
index 865e2c9..60170ea 100644
@@ -75,7 +75,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
                OUT_RING(CP_PACKET0(R300_RE_CLIPRECT_TL_0, nr * 2 - 1));
 
                for (i = 0; i < nr; ++i) {
-                       if (DRM_COPY_FROM_USER_UNCHECKED
+                       if (DRM_COPY_FROM_USER
                            (&box, &cmdbuf->boxes[n + i], sizeof(box))) {
                                DRM_ERROR("copy cliprect faulted\n");
                                return -EFAULT;
--

1.7.9.5

--
Kees Cook
Chrome OS Security
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel