Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6-0]: src/sys/compat/netbsd32 Pull up revision 1.31, requested by...



details:   https://anonhg.NetBSD.org/src/rev/bfd27ff5a83d
branches:  netbsd-6-0
changeset: 775024:bfd27ff5a83d
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Dec 14 14:03:28 2014 +0000

description:
Pull up revision 1.31, requested by maxv in #1209:

Prevent a user-triggerable kmem_alloc(0).

diffstat:

 sys/compat/netbsd32/netbsd32_compat_30.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 06227ec778c4 -r bfd27ff5a83d sys/compat/netbsd32/netbsd32_compat_30.c
--- a/sys/compat/netbsd32/netbsd32_compat_30.c  Fri Dec 12 07:28:02 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_30.c  Sun Dec 14 14:03:28 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_compat_30.c,v 1.30 2010/04/23 15:19:20 rmind Exp $    */
+/*     $NetBSD: netbsd32_compat_30.c,v 1.30.20.1 2014/12/14 14:03:28 martin Exp $      */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.30 2010/04/23 15:19:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.30.20.1 2014/12/14 14:03:28 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -78,6 +78,9 @@
                error = EBADF;
                goto out;
        }
+       if (count == 0)
+               goto out;
+
        buf = kmem_alloc(count, KM_SLEEP);
        error = vn_readdir(fp, buf, UIO_SYSSPACE, count, &done, l, 0, 0);
        if (error == 0) {



Home | Main Index | Thread Index | Old Index