Re: __get_free_pages(): is the MEM really mine?

Eric W. Biederman
2001-09-27T14:47:44Z

Bernd Harries <mlbha@gmx.de> writes:

> Hi all,

> In a driver I'm writing, in the open() method, I use multiple
> __get_free_pages() to allocate a 4 MB kernel (image)buffer for DMA purposes.
> The buffer I get is contiguous (I try until it is) and is freed in
> close(). Order count is 9.

Ouch. This is where I give you the standard recommendation. If you
do this scatter gatter (so you don't need megs of continuous memory)
you should be much better off, and your driver should be more
reliable. All of the other techniques you have used like mmap should
still apply.

Also if you are exporting this data to user space, before your DMA
complets you want to zero the pages you have allocated, so you don't
have an information leak.

Eric