From 7e96ea1294f35620ca8f4a439114500dcb84faa9 Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Wed, 9 Jun 2021 17:09:05 -0700 Subject: [PATCH] iris: don't munmap NULL pointers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Lionel Landwerlin Reviewed-by: Kenneth Graunke Signed-off-by: Paulo Zanoni Part-of: --- 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) {