The Linux kernel version 2.6.29-rc7 introduced a regression that makes a mmap2() call on /dev/dri/card0 fail with EAGAIN on Savage chipsets (don't know about other chipsets yet). I have not yet bisected it or filed a bug for it (since I want to check 2.6.29-rc8 for this bug), but this in turn uncovered a bug in my recent changes to the savage driver. When DRI is not available, an attempt to query available memory for xvideo via AGP (which requires DRI) results in a NULL pointer access to psav->DRIServerInfo, even if xvideo is configured not to use AGP. This patch fixes it by adding a NULL pointer check that allows it to use the previously-available framebuffer upload for xvideo while I hunt down this bug.

Changelog:
* Add NULL pointer check before trying to access DRIServerInfo, since it might be NULL when DRI fails to initialize.

--
perl -e '$x=2.3;printf("%.0f + %.0f = %.0f\n",$x,$x,$x+$x);'

>From ce37ca3de7aa80f176295ad8d5ace111ec28888a Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Alex=20Villac=C3=ADs=20Lasso?= <[email protected]>
Date: Sat, 14 Mar 2009 21:34:48 -0500
Subject: [PATCH] Fix crash by null pointer access when DRI is not available.

---
 src/savage_video.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/savage_video.c b/src/savage_video.c
index 57483e0..bccb801 100644
--- a/src/savage_video.c
+++ b/src/savage_video.c
@@ -1965,7 +1965,7 @@ SavagePutImage(
 
     /* Check whether AGP buffers can be allocated. If not, fall back to 
ordinary
        upload to framebuffer (slower) */
-    if (!pPriv->tried_agp && !psav->IsPCI && psav->drmFD > 0) {
+    if (!pPriv->tried_agp && !psav->IsPCI && psav->drmFD > 0 && 
psav->DRIServerInfo != NULL) {
         int ret;
        SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo;
         
-- 
1.6.0.6

_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to