drm/ttm: Fix a NULL pointer dereference
[linux-2.6-microblaze.git] / drivers / gpu / drm / ttm / ttm_device.c
index e7147e3..b84f748 100644 (file)
@@ -158,7 +158,7 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx,
                        struct ttm_buffer_object *bo = res->bo;
                        uint32_t num_pages;
 
-                       if (!bo)
+                       if (!bo || bo->resource != res)
                                continue;
 
                        num_pages = PFN_UP(bo->base.size);