diff options
author | hselasky <hselasky@FreeBSD.org> | 2012-08-15 16:19:39 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2012-08-15 16:19:39 +0000 |
commit | cd2aff73464a800a4055a28629369fe7640150be (patch) | |
tree | 1000f4d07590bc41e68544d52176932383b84915 /share | |
parent | c92e1b68a6eaa87cbe2e4382cf95fd57d37583b7 (diff) | |
download | FreeBSD-src-cd2aff73464a800a4055a28629369fe7640150be.zip FreeBSD-src-cd2aff73464a800a4055a28629369fe7640150be.tar.gz |
Streamline use of cdevpriv and correct some corner cases.
1) It is not useful to call "devfs_clear_cdevpriv()" from
"d_close" callbacks, hence for example read, write, ioctl and
so on might be sleeping at the time of "d_close" being called
and then then freed private data can still be accessed.
Examples: dtrace, linux_compat, ksyms (all fixed by this patch)
2) In sys/dev/drm* there are some cases in which memory will
be freed twice, if open fails, first by code in the open
routine, secondly by the cdevpriv destructor. Move registration
of the cdevpriv to the end of the drm open routines.
3) devfs_clear_cdevpriv() is not called if the "d_open" callback
registered cdevpriv data and the "d_open" callback function
returned an error. Fix this.
Discussed with: phk
MFC after: 2 weeks
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/devfs_set_cdevpriv.9 | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/share/man/man9/devfs_set_cdevpriv.9 b/share/man/man9/devfs_set_cdevpriv.9 index a2b0279..736a007 100644 --- a/share/man/man9/devfs_set_cdevpriv.9 +++ b/share/man/man9/devfs_set_cdevpriv.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 8, 2008 +.Dd August 15, 2012 .Dt DEVFS_CDEVPRIV 9 .Os .Sh NAME @@ -79,6 +79,10 @@ finished operating, the callback is called, with private data supplied .Va data argument. +The +.Fn devfs_clear_cdevpriv +function will be also be called if the open callback +function returns an error code. .Pp On the last filedescriptor close, system automatically arranges .Fn devfs_clear_cdevpriv |