lkml.org 
[lkml]   [1998]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mmap(), close(), and dget()
Itai Nahshon wrote:
>
> 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?
> >

> 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?

You might want to look into defining a vma close op to defer device closing
until the vma goes away. Each vma could hold an open count for the device, and
the device wouldn't go away until the last vma had been closed.

Regards,
Bill

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.070 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site