Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/ttm Revert ttm_bo.c 1.3 and t...



details:   https://anonhg.NetBSD.org/src/rev/302fbb84965d
branches:  trunk
changeset: 331015:302fbb84965d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jul 27 00:40:39 2014 +0000

description:
Revert ttm_bo.c 1.3 and try to fix the double-free properly.

bo->destroy doesn't ttm_tt_destroy or ttm_tt_fini anything.  Trouble
is that ttm_tt_fini expects the swap storage to still be there, and
ttm_tt_destroy -- which is what calls ttm_tt_fini by way of
ttm->func->destroy -- has already nulled it out.

diffstat:

 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c |  2 +-
 sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 6b7b9d7434a8 -r 302fbb84965d sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c       Sat Jul 26 22:21:16 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c       Sun Jul 27 00:40:39 2014 +0000
@@ -159,7 +159,7 @@
        BUG_ON(!list_empty(&bo->lru));
        BUG_ON(!list_empty(&bo->ddestroy));
 
-       if (bo->destroy == NULL && bo->ttm)
+       if (bo->ttm)
                ttm_tt_destroy(bo->ttm);
        atomic_dec(&bo->glob->bo_count);
        if (bo->resv == &bo->ttm_resv)
diff -r 6b7b9d7434a8 -r 302fbb84965d sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c       Sat Jul 26 22:21:16 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c       Sun Jul 27 00:40:39 2014 +0000
@@ -185,9 +185,9 @@
        if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP) &&
            ttm->swap_storage)
                fput(ttm->swap_storage);
-#endif
 
        ttm->swap_storage = NULL;
+#endif
        ttm->func->destroy(ttm);
 }
 



Home | Main Index | Thread Index | Old Index