提交 182b17c8 编写于 作者: B Ben Skeggs 提交者: Dave Airlie

drm/ttm: fix the tt_populated check in ttm_tt_destroy()

After a vmalloc failure in ttm_dma_tt_alloc_page_directory(),
ttm_dma_tt_init() will call ttm_tt_destroy() to cleanup, and end up
inside the driver's unpopulate() hook when populate() has never yet
been called.

On nouveau, the first issue to be hit because of this is that
dma_address[] may be a NULL pointer.  After working around this,
ttm_pool_unpopulate() may potentially hit the same issue with
the pages[] array.

It seems to make more sense to avoid calling unpopulate on already
unpopulated TTMs than to add checks to all the implementations.
Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
Reviewed-by: NThomas Hellstrom <thellstrom@vmware.com>
Cc: stable@vger.kernel.org
Cc: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 4f7d1bc9
...@@ -170,7 +170,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm) ...@@ -170,7 +170,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm)
ttm_tt_unbind(ttm); ttm_tt_unbind(ttm);
} }
if (likely(ttm->pages != NULL)) { if (ttm->state == tt_unbound) {
ttm->bdev->driver->ttm_tt_unpopulate(ttm); ttm->bdev->driver->ttm_tt_unpopulate(ttm);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册