From owner-svn-src-stable-11@freebsd.org Thu Mar 30 20:04:30 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AD46D26610; Thu, 30 Mar 2017 20:04:30 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE83AE3B; Thu, 30 Mar 2017 20:04:29 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2UK4TnJ046134; Thu, 30 Mar 2017 20:04:29 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2UK4T5w046133; Thu, 30 Mar 2017 20:04:29 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201703302004.v2UK4T5w046133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Thu, 30 Mar 2017 20:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r316295 - stable/11/sys/compat/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Mar 2017 20:04:30 -0000 Author: dchagin Date: Thu Mar 30 20:04:28 2017 New Revision: 316295 URL: https://svnweb.freebsd.org/changeset/base/316295 Log: MFC r314309: Return EINVAL when an invalid file descriptor is specified. Modified: stable/11/sys/compat/linux/linux_event.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_event.c ============================================================================== --- stable/11/sys/compat/linux/linux_event.c Thu Mar 30 20:03:20 2017 (r316294) +++ stable/11/sys/compat/linux/linux_event.c Thu Mar 30 20:04:28 2017 (r316295) @@ -462,8 +462,10 @@ linux_epoll_ctl(struct thread *td, struc 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 *t 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;