DF-1685 / fix.diff
diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -679,12 +679,14 @@ struct agp_memory *mem; AGP_DPF("searching for memory block %d\n", id); + lockmgr(&sc->as_lock, LK_EXCLUSIVE); TAILQ_FOREACH(mem, &sc->as_memory, am_link) { AGP_DPF("considering memory block %d\n", mem->am_id); if (mem->am_id == id) - return mem; + break; } - return 0; + lockmgr(&sc->as_lock, LK_RELEASE); + return mem; } /* Implementation of the userland ioctl api */ |