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/radeon Fix possible bus_dmama...



details:   https://anonhg.NetBSD.org/src/rev/4c461357c7e2
branches:  trunk
changeset: 1009583:4c461357c7e2
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon Apr 27 16:57:31 2020 +0000

description:
Fix possible bus_dmamap_load(9) leak.  PR/55127

"Looks good to me" from riastradh@.
Note it was also commented "that code path is likely to be reached"
so maybe pullups are not necessary.

diffstat:

 sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 6e628502a5d1 -r 4c461357c7e2 sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c        Mon Apr 27 16:55:50 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c        Mon Apr 27 16:57:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeon_ttm.c,v 1.16 2020/02/14 04:38:24 riastradh Exp $        */
+/*     $NetBSD: radeon_ttm.c,v 1.17 2020/04/27 16:57:31 tsutsui Exp $  */
 
 /*
  * Copyright 2009 Jerome Glisse.
@@ -32,7 +32,7 @@
  *    Dave Airlie
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_ttm.c,v 1.16 2020/02/14 04:38:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_ttm.c,v 1.17 2020/04/27 16:57:31 tsutsui Exp $");
 
 #include <ttm/ttm_bo_api.h>
 #include <ttm/ttm_bo_driver.h>
@@ -923,6 +923,11 @@
 #endif
        bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
 
+#ifdef __NetBSD__
+       if (slave && ttm->sg) {
+               bus_dmamap_unload(ttm->bdev->dmat, gtt->ttm.dma_address);
+       }
+#endif
        if (gtt && gtt->userptr) {
                kfree(ttm->sg);
                ttm->page_flags &= ~TTM_PAGE_FLAG_SG;



Home | Main Index | Thread Index | Old Index