diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-01-28 19:34:23 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-01-28 19:34:23 +0000 |
commit | f8a38f23d2503317bf965e741c083d46fbfaedf3 (patch) | |
tree | ce4c2ddafdbfeb05d2c35d162cda33d18aef993d /xserver | |
parent | cbdcee6eb87e933167a056c1332f955ad23d70e7 (diff) |
Effectively close the AGP device fd in xf86GARTCloseScreen() if it's
different from the consoleFd. Fixes crashes at server reset.
"looks good" miod@, oga@. Tested by shadchin@.
Diffstat (limited to 'xserver')
-rw-r--r-- | xserver/hw/xfree86/os-support/bsd/bsd_agp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_agp.c b/xserver/hw/xfree86/os-support/bsd/bsd_agp.c index 5e5077e8d..8330dee72 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_agp.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bsd_agp.c,v 1.3 2008/04/01 21:08:01 matthieu Exp $ */ +/* $OpenBSD: bsd_agp.c,v 1.4 2011/01/28 19:34:22 matthieu Exp $ */ /* * Abstraction of the AGP GART interface. * @@ -40,6 +40,8 @@ Bool xf86GARTCloseScreen(int screenNum) { if(gartFd != -1) { + if (gartFd != xf86Info.consoleFd) + close(gartFd); acquiredScreen = -1; gartFd = -1; initDone = FALSE; @@ -72,6 +74,8 @@ GARTInit(int screenNum) /* try the old interface */ gartFd = xf86Info.consoleFd; } + if (gartFd == -1) + return FALSE; xf86AcquireGART(-1); /* Check the kernel driver version. */ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { |