Module Name: src
Committed By: dsl
Date: Sun Oct 11 17:20:48 UTC 2009
Modified Files:
src/sys/kern: tty.c
Log Message:
Check for zero length read here - and return zero.
Most times we've come through spec_read() which has already done the test,
but not always (eg pty with ptsfs mounted).
Without this there is a simple local-user panic in ureadc().
Noted Matthew Mondor on tech-kern.
To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/kern/tty.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/tty.c
diff -u src/sys/kern/tty.c:1.233 src/sys/kern/tty.c:1.234
--- src/sys/kern/tty.c:1.233 Fri Oct 2 23:58:53 2009
+++ src/sys/kern/tty.c Sun Oct 11 17:20:48 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.233 2009/10/02 23:58:53 elad Exp $ */
+/* $NetBSD: tty.c,v 1.234 2009/10/11 17:20:48 dsl Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.233 2009/10/02 23:58:53 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.234 2009/10/11 17:20:48 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1669,6 +1669,9 @@
long lflag, slp;
struct timeval now, stime;
+ if (uio->uio_resid == 0)
+ return 0;
+
stime.tv_usec = 0; /* XXX gcc */
stime.tv_sec = 0; /* XXX gcc */