Re: mmap(), close(), and dget()

Itai Nahshon (nahshon@actcom.co.il)
Tue, 03 Feb 1998 15:17:27 +0200


Jason McMullan wrote:
>
> Hi there everybody! Ok, here's my problem
> (character device driver)
>
> 1) App open()s my device inode
> *) dev->open() called.
>
> 2) App mmap()s some memory through the device
> *) dev->mmap() called
> *) I do the MMAP dance..
> *) I set vma->vm_dentry=dget(file->dentry);
>
> 3) App exits
> *) dev->close() called
> *) vma is unregistered
>
> Isn't that the wrong order for #3? Shouldn't the
> vma's for mallocs be cleaned BEFORE dev->close() is
> called?
>
> --
> Jason McMullan - Linux - GGI - http://beans.visus.com/~jmcc
> NT 5.0 is the last nail in the Unix coffin. Interestingly, Unix
> isn't in the coffin... It's wondering what the heck is sealing
> itself into a wooden box 6 feet underground...

IMHO you are right, the same problem may also lead to security
reason. See the thread of discussions about sound security
from last week.
That is real problem only for a small set of character devices which
have both mmap and release functions pointed by their file_operations.
I know about sound and about fbmem (fbmem is never used in x86 systems).
Does it raise new problems in GGI?

Itai

-- 
Itai Nahshon   nahshon@actcom.co.il
        Also   nahshon@vnet.ibm.com