Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 User-triggerable kmem_alloc(0).



details:   https://anonhg.NetBSD.org/src/rev/3a9f9f4d69eb
branches:  trunk
changeset: 804900:3a9f9f4d69eb
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Dec 05 17:26:21 2014 +0000

description:
User-triggerable kmem_alloc(0).

Ok martin@ christos@

User

diffstat:

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

diffs (28 lines):

diff -r 04d52637bb29 -r 3a9f9f4d69eb sys/compat/netbsd32/netbsd32_compat_30.c
--- a/sys/compat/netbsd32/netbsd32_compat_30.c  Fri Dec 05 15:25:27 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_30.c  Fri Dec 05 17:26:21 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.31 2014/12/05 17:26:21 maxv 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.31 2014/12/05 17:26:21 maxv 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