Module Name: src
Committed By: tsutsui
Date: Mon Apr 27 16:57:31 UTC 2020
Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_ttm.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c:1.16 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c:1.17
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c:1.16 Fri Feb 14 04:38:24 2020
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c Mon Apr 27 16:57:31 2020
@@ -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 @@ static void radeon_ttm_tt_unpopulate(str
#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;