Mesa (master): r300g: fix crash when adding a new relocation

Marek Olšák mareko at kemper.freedesktop.org
Fri Apr 8 12:35:42 PDT 2011


Module: Mesa
Branch: master
Commit: aac4bae98651c928ce298aecf158b0aa1a7fabce
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aac4bae98651c928ce298aecf158b0aa1a7fabce

Author: Marek Olšák <maraeo at gmail.com>
Date:   Fri Apr  8 20:42:03 2011 +0200

r300g: fix crash when adding a new relocation

No idea why it's so hard to reproduce.
Broken with: c35572352e3e92683988ee8d151b47f4190d62f9

Thanks to Toni Spets for assistance.

---

 src/gallium/winsys/radeon/drm/radeon_drm_cs.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index 7576f3a..f235336 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -265,8 +265,9 @@ static void radeon_add_reloc(struct radeon_cs_context *csc,
     }
 
     /* Initialize the new relocation. */
-    p_atomic_inc(&bo->num_cs_references);
+    csc->relocs_bo[csc->crelocs] = NULL;
     radeon_bo_reference(&csc->relocs_bo[csc->crelocs], bo);
+    p_atomic_inc(&bo->num_cs_references);
     reloc = &csc->relocs[csc->crelocs];
     reloc->handle = bo->handle;
     reloc->read_domains = rd;



More information about the mesa-commit mailing list