Bug 27849

Summary: AGP RELEASE ioctl frees memory
Product: Base System Reporter: simonw <simonw>
Component: kernAssignee: dfr
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description simonw 2001-06-03 06:10:01 UTC
The implementation of the ioctl AGPIOC_RELEASE includes the following
code:

        /*
         * Clear out the aperture and free any outstanding memory blocks.
         */     
        while ((mem = TAILQ_FIRST(&sc->as_memory)) != 0) {
                if (mem->am_is_bound)
                        AGP_UNBIND_MEMORY(dev, mem);
                AGP_FREE_MEMORY(dev, mem);
        }

Clearly this deallocates all the memory that the application
has attached to the AGP space. Yet the spec for the agp ioctls
(at least the one I have) states that this ioctl merely releases
control of the agp device - it doesn't deallocate memory that the
app allocated while it had control. That is done with the UNBIND
and DEALLOCATE commands.

   The Utah GLX code certainly assumes this behaviour - I had to
comment out the RELEASE ioctl to get it to work with FreeBSD.

Fix: 

I think just taking out the code segment given above
will suffice.
How-To-Repeat: Use Xfree86 3.3.5 with the Utah GLX module (add -DHAVE_LINUX_NEWAGP).
It will complain about
Comment 1 ru freebsd_committer freebsd_triage 2001-06-04 11:45:23 UTC
Responsible Changed
From-To: freebsd-bugs->dfr

Over to the author of the code.
Comment 2 Eric Anholt freebsd_committer freebsd_triage 2003-01-18 04:41:52 UTC
State Changed
From-To: open->closed

Fixed in r1.14 of agp.c (in 2001).