Mesa (main): iris: don't munmap NULL pointers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 10 21:04:59 UTC 2021


Module: Mesa
Branch: main
Commit: 7e96ea1294f35620ca8f4a439114500dcb84faa9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e96ea1294f35620ca8f4a439114500dcb84faa9

Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Wed Jun  9 17:09:05 2021 -0700

iris: don't munmap NULL pointers

This is a regression, the previous commit had this check which was
removed in the patch mentioned below. What happens is that when we
have a buffer that's not mmapped and we try to bo_free it we get some
very funny backtraces. Easily reproducible with fullscreen
gputest.triangle.

Fixes: f62724ccacff ("iris: Pick a single mmap mode (WB/WC) at BO allocation time")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4890
Tested-by: Michel Dänzer <mdaenzer at redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11284>

---

 src/gallium/drivers/iris/iris_bufmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index ecaaaa2b311..230df645812 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -785,7 +785,7 @@ bo_free(struct iris_bo *bo)
 {
    struct iris_bufmgr *bufmgr = bo->bufmgr;
 
-   if (!bo->userptr)
+   if (!bo->userptr && bo->map)
       bo_unmap(bo);
 
    if (bo->idle) {



More information about the mesa-commit mailing list