iris: don't munmap NULL pointers
authorPaulo Zanoni <paulo.r.zanoni@intel.com>
Thu, 10 Jun 2021 00:09:05 +0000 (17:09 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 10 Jun 2021 20:49:59 +0000 (20:49 +0000)
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@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11284>

src/gallium/drivers/iris/iris_bufmgr.c

index ecaaaa2..230df64 100644 (file)
@@ -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) {