diff mbox

[i-g-t] gem_storedw_loop: fix segfault when listing subtests

Message ID 1443089594-20673-1-git-send-email-thomas.wood@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Wood Sept. 24, 2015, 10:13 a.m. UTC
Commit fb66cd5 (tests/gem_storedw_loop: Fix use after free for bufmgr)
introduced a segmentation fault when listing subtests because
drm_intel_bufmgr_destroy is called with NULL. Move this and the call to
the close function inside an igt_fixture block to prevent them being
called when listing subtests.

Cc: Robert Beckett <robert.beckett@intel.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 tests/gem_storedw_loop.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jesse Barnes Sept. 24, 2015, 3:23 p.m. UTC | #1
On 09/24/2015 03:13 AM, Thomas Wood wrote:
> Commit fb66cd5 (tests/gem_storedw_loop: Fix use after free for bufmgr)
> introduced a segmentation fault when listing subtests because
> drm_intel_bufmgr_destroy is called with NULL. Move this and the call to
> the close function inside an igt_fixture block to prevent them being
> called when listing subtests.
> 
> Cc: Robert Beckett <robert.beckett@intel.com>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> ---
>  tests/gem_storedw_loop.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/gem_storedw_loop.c b/tests/gem_storedw_loop.c
> index e7ebcc2..e17e190 100644
> --- a/tests/gem_storedw_loop.c
> +++ b/tests/gem_storedw_loop.c
> @@ -180,6 +180,8 @@ igt_main
>  		}
>  	}
>  
> -	drm_intel_bufmgr_destroy(bufmgr);
> -	close(fd);
> +	igt_fixture {
> +		drm_intel_bufmgr_destroy(bufmgr);
> +		close(fd);
> +	}
>  }
> 

Um, yes. :)  I won't pretend to know how the fixture stuff ought to
work, so:
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
diff mbox

Patch

diff --git a/tests/gem_storedw_loop.c b/tests/gem_storedw_loop.c
index e7ebcc2..e17e190 100644
--- a/tests/gem_storedw_loop.c
+++ b/tests/gem_storedw_loop.c
@@ -180,6 +180,8 @@  igt_main
 		}
 	}
 
-	drm_intel_bufmgr_destroy(bufmgr);
-	close(fd);
+	igt_fixture {
+		drm_intel_bufmgr_destroy(bufmgr);
+		close(fd);
+	}
 }