From def1240ba27369b4e457dc3a8adf7d667aaa3744 Mon Sep 17 00:00:00 2001 From: rodrigc Date: Sat, 14 Jul 2007 21:18:19 +0000 Subject: [PATCH] The last entry in the ext2_opts array must be NULL, otherwise the kernel with crash in vfs_filteropt() if an invalid mount option is passed to ext2fs. Approved by: re (kensmith) --- sys/gnu/fs/ext2fs/ext2_vfsops.c | 2 +- sys/kern/kern_event.c | 9 +++++++++ sys/kern/vfs_mount.c | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index ab70b23f803f..d5ad6f22feb4 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -119,7 +119,7 @@ static int compute_sb_data(struct vnode * devvp, static const char *ext2_opts[] = { "from", "export", "union", "acls", "exec", "atime", "union", "suiddir", "multilabel", "symfollow", "clusterr", - "clusterw", "force" }; + "clusterw", "force", NULL }; /* * VFS Operations. diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index aa446b6079f7..f7f9f1c01e15 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1059,6 +1059,15 @@ kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident, int fd; int mflag = waitok ? M_WAITOK : M_NOWAIT; + /* + * knote locks the KQ and filt_proc calls kqueue_register if _TRACK + * is set. Return early so we don't assert KQ_NOTOWNED in this + * case. We have a knote in the hash, so we have the table. + */ + if ((fops->f_isfd && kq->kq_knlistsize > ident) || + (!fops->f_isfd && kq->kq_knhashmask != 0)) + return 0; + KQ_NOTOWNED(kq); if (fops->f_isfd) { diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 82bb76736810..7106b2cf8771 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -638,6 +638,10 @@ vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions) fsflags &= ~MNT_ASYNC; else if (strcmp(opt->name, "noatime") == 0) fsflags |= MNT_NOATIME; + else if (strcmp(opt->name, "atime") == 0) { + free(opt->name, M_MOUNT); + opt->name = strdup("nonoatime", M_MOUNT); + } else if (strcmp(opt->name, "noclusterr") == 0) fsflags |= MNT_NOCLUSTERR; else if (strcmp(opt->name, "noclusterw") == 0)