Page MenuHomeFreeBSD

D53774.id166515.diff
No OneTemporary

D53774.id166515.diff

diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c
--- a/sys/kern/vfs_inotify.c
+++ b/sys/kern/vfs_inotify.c
@@ -381,7 +381,14 @@
static void
inotify_free_watch(struct inotify_watch *watch)
{
- vrele(watch->vp);
+ /*
+ * Formally, we don't need to lock the vnode here. However, if we
+ * don't, and vrele() releases the last reference, it's possible the
+ * vnode will be recycled while a different thread holds the vnode lock.
+ * Work around this bug by acquiring the lock here.
+ */
+ (void)vn_lock(watch->vp, LK_EXCLUSIVE | LK_RETRY);
+ vput(watch->vp);
free(watch, M_INOTIFY);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 5, 8:56 AM (20 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29279176
Default Alt Text
D53774.id166515.diff (609 B)

Event Timeline