Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Mar 2017 20:04:29 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
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
Message-ID:  <201703302004.v2UK4T5w046133@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703302004.v2UK4T5w046133>