Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152945185
D56318.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
877 B
Referenced Files
None
Subscribers
None
D56318.diff
View Options
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1822,12 +1822,6 @@
kn->kn_fp = fp;
kn->kn_kq = kq;
kn->kn_fop = fops;
- /*
- * apply reference counts to knote structure, and
- * do not release it at the end of this routine.
- */
- fops = NULL;
- fp = NULL;
kn->kn_sfflags = kev->fflags;
kn->kn_sdata = kev->data;
@@ -1848,6 +1842,16 @@
goto done;
}
+ /*
+ * We transfer ownership of fops/fp to the knote
+ * structure and avoid releasing them at the end of
+ * this routine, now that all of the remaining exit
+ * paths will knote_drop() to release the reference
+ * counts we held on them above.
+ */
+ fops = NULL;
+ fp = NULL;
+
if ((error = kn->kn_fop->f_attach(kn)) != 0) {
knote_drop_detached(kn, td);
goto done;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 6:04 AM (19 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31172568
Default Alt Text
D56318.diff (877 B)
Attached To
Mode
D56318: kqueue: don't leak file refs on failure to knote_attach()
Attached
Detach File
Event Timeline
Log In to Comment