summaryrefslogtreecommitdiffstats
path: root/sbin/umount
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2004-03-04 00:17:14 +0000
committerwpaul <wpaul@FreeBSD.org>2004-03-04 00:17:14 +0000
commit3ca539236dcf413518191a1d538f5f13738e48f1 (patch)
treee65ab2e76599cec8f1d433256283cf01d711e5b1 /sbin/umount
parente6b61c95ada68d1539282488ed4edda94ecb2178 (diff)
downloadFreeBSD-src-3ca539236dcf413518191a1d538f5f13738e48f1.zip
FreeBSD-src-3ca539236dcf413518191a1d538f5f13738e48f1.tar.gz
Add sanity checks to the ndis_packet and ndis_buffer pool handling
routines to guard against problems caused by (possibly) buggy drivers. The RealTek 8180 wireless driver calls NdisFreeBuffer() to release some of its buffers _after_ it's already called NdisFreeBufferPool() to destroy the pool to which the buffers belong. In our implementation, this error causes NdisFreeBuffer() to touch stale heap memory. If you are running a release kernel, and hence have INVARIANTS et al turned off, it turns out nothing happens. But if you're using a development kernel config with INVARIANTS on, the malloc()/free() sanity checks will scribble over the pool memory with 0xdeadc0de once it's released so that any attempts to touch it will cause a trap, and indeed this is what happens. It happens that I run 5.2-RELEASE on my laptop, so when I tested the rtl8180.sys driver, it worked fine for me, but people trying to run it with development systems checked out or cvsupped from -current would get a page fault on driver load. I can't find any reason why the NDISulator would cause the RealTek driver to do the NdisFreeBufferPool() prematurely, and the same driver obviously works with Windows -- or at least, it doesn't cause a crash: the Microsoft documentation for NdisFreeBufferPool() says that failing to return all buffers to the pool before calling NdisFreeBufferPool() causes a memory leak. I've written to my contacts at RealTek asking them to check if this is indeed a bug in their driver. In the meantime, these new sanity checks will catch this problem and issue a warning rather than causing a trap. The trick is to keep a count of outstanding buffers for each buffer pool, and if the driver tries to call NdisFreeBufferPool() while there are still buffers outstanding, we mark the pool for deletion and then defer destroying it until after the last buffer has been reclaimed.
Diffstat (limited to 'sbin/umount')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud