diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c index 544914794df..973b5ea44b7 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -462,8 +462,10 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ctl_args *args) cap_rights_init(&rights, CAP_KQUEUE_CHANGE), &epfp); if (error != 0) return (error); - if (epfp->f_type != DTYPE_KQUEUE) + if (epfp->f_type != DTYPE_KQUEUE) { + error = EINVAL; goto leave1; + } /* Protect user data vector from incorrectly supplied fd. */ error = fget(td, args->fd, cap_rights_init(&rights, CAP_POLL_EVENT), &fp); @@ -560,6 +562,10 @@ linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event *events, cap_rights_init(&rights, CAP_KQUEUE_EVENT), &epfp); if (error != 0) return (error); + if (epfp->f_type != DTYPE_KQUEUE) { + error = EINVAL; + goto leave; + } coargs.leventlist = events; coargs.p = td->td_proc;