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 /sys/ofed | |
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 'sys/ofed')
-rw-r--r-- | sys/ofed/include/linux/linux_compat.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/sys/ofed/include/linux/linux_compat.c b/sys/ofed/include/linux/linux_compat.c index 90737f2..fb3783a 100644 --- a/sys/ofed/include/linux/linux_compat.c +++ b/sys/ofed/include/linux/linux_compat.c @@ -263,7 +263,6 @@ linux_dev_close(struct cdev *dev, int fflag, int devtype, struct thread *td) if ((error = devfs_get_cdevpriv((void **)&filp)) != 0) return (error); filp->f_flags = file->f_flag; - devfs_clear_cdevpriv(); return (0); } |