Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern make sure we cleanup properly when fd is too big.
details: https://anonhg.NetBSD.org/src/rev/3ce5082fa50b
branches: trunk
changeset: 816621:3ce5082fa50b
user: christos <christos%NetBSD.org@localhost>
date: Thu Jul 14 18:16:51 2016 +0000
description:
make sure we cleanup properly when fd is too big.
diffstat:
sys/kern/kern_event.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diffs (31 lines):
diff -r c1c79c8fdd15 -r 3ce5082fa50b sys/kern/kern_event.c
--- a/sys/kern/kern_event.c Thu Jul 14 17:43:48 2016 +0000
+++ b/sys/kern/kern_event.c Thu Jul 14 18:16:51 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_event.c,v 1.87 2016/07/14 06:22:17 christos Exp $ */
+/* $NetBSD: kern_event.c,v 1.88 2016/07/14 18:16:51 christos Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.87 2016/07/14 06:22:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.88 2016/07/14 18:16:51 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -936,10 +936,8 @@
if (kfilter->filtops->f_isfd) {
/* monitoring a file descriptor */
/* validate descriptor */
- if (kev->ident > INT_MAX)
- return EBADF;
- fd = kev->ident;
- if ((fp = fd_getfile(fd)) == NULL) {
+ if (kev->ident > INT_MAX
+ || (fp = fd_getfile(fd = kev->ident)) == NULL) {
rw_exit(&kqueue_filter_lock);
kmem_free(newkn, sizeof(*newkn));
return EBADF;
Home |
Main Index |
Thread Index |
Old Index