drm/ttm: request zeroed system memory pages for new TT buffer objects
authorBen Skeggs <bskeggs@redhat.com>
Tue, 13 Sep 2011 20:08:06 +0000 (06:08 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 14 Sep 2011 12:34:51 +0000 (13:34 +0100)
Fixes an information leak to userspace, we were handing out un-zeroed pages
for any newly created TTM_PL_TT buffer.

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/ttm/ttm_bo.c

index a4d38d85909a0254e23fa3a1f0b607814329bf60..ef06194c5aa6049c4813db6048f22922b1b5eaed 100644 (file)
@@ -394,7 +394,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
 
        if (!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) {
                if (bo->ttm == NULL) {
-                       ret = ttm_bo_add_ttm(bo, false);
+                       bool zero = !(old_man->flags & TTM_MEMTYPE_FLAG_FIXED);
+                       ret = ttm_bo_add_ttm(bo, zero);
                        if (ret)
                                goto out_err;
                }