diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-08-17 21:31:39 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-08-17 21:31:39 +0000 |
commit | 04c1d97ac4f49769e4f9b21f57be863c91800874 (patch) | |
tree | 3319b8460927b8f3a97a379962853dc4dc8c42ba /sys | |
parent | ba2f462521b163a2263395aa0a81ddf47dcf0d27 (diff) |
Check that the driver properly initialised before allowing agp_acquire()
to succeed.
Inspired by Tobias Ulmer, thanks!
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/agp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c index e61894f9307..54100016da3 100644 --- a/sys/dev/pci/agp.c +++ b/sys/dev/pci/agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp.c,v 1.24 2008/07/12 17:31:06 oga Exp $ */ +/* $OpenBSD: agp.c,v 1.25 2008/08/17 21:31:38 oga Exp $ */ /*- * Copyright (c) 2000 Doug Rabson * All rights reserved. @@ -751,6 +751,9 @@ agp_acquire_helper(void *dev, enum agp_acquire_state state) { struct agp_softc *sc = (struct agp_softc *)dev; + if (sc->sc_chipc == NULL) + return (EINVAL); + if (sc->sc_state != AGP_ACQUIRE_FREE) return (EBUSY); sc->sc_state = state; @@ -965,8 +968,7 @@ agp_unbind_memory(void *dev, void *handle) } void -agp_memory_info(void *dev, void *handle, struct - agp_memory_info *mi) +agp_memory_info(void *dev, void *handle, struct agp_memory_info *mi) { struct agp_memory *mem = (struct agp_memory *) handle; |