panfrost: Fix write to free'd memory
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 9 Jul 2020 23:13:59 +0000 (19:13 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Jul 2020 14:42:33 +0000 (14:42 +0000)
No clue how this worked before.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Fixes: 82f18b713ac ("panfrost: Keep track of active BOs")
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5859>

src/panfrost/encoder/pan_bo.c

index 53249e8730192b3ee0127b742dde0faace0917d4..b25e91d5d2275caf9245d5993757962b594251bd 100644 (file)
@@ -502,7 +502,7 @@ panfrost_bo_import(struct panfrost_device *dev, int fd)
                  * acquired it in the meantime.
                  */
                 if (p_atomic_read(&bo->refcnt) == 0)
-                        p_atomic_set(&newbo->refcnt, 1);
+                        p_atomic_set(&bo->refcnt, 1);
                 else
                         panfrost_bo_reference(bo);
                 assert(bo->cpu);