Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/linux/common Reject non-regular files.



details:   https://anonhg.NetBSD.org/src/rev/345906773934
branches:  trunk
changeset: 803508:345906773934
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Oct 30 16:45:28 2014 +0000

description:
Reject non-regular files.

Patch from njoly@.

diffstat:

 sys/compat/linux/common/linux_uselib.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 06100b918642 -r 345906773934 sys/compat/linux/common/linux_uselib.c
--- a/sys/compat/linux/common/linux_uselib.c    Thu Oct 30 15:13:11 2014 +0000
+++ b/sys/compat/linux/common/linux_uselib.c    Thu Oct 30 16:45:28 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_uselib.c,v 1.31 2014/10/19 17:33:58 maxv Exp $   */
+/*     $NetBSD: linux_uselib.c,v 1.32 2014/10/30 16:45:28 maxv Exp $   */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.31 2014/10/19 17:33:58 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_uselib.c,v 1.32 2014/10/30 16:45:28 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -100,6 +100,11 @@
        if (error != 0)
                return error;
 
+       if (vp->v_type != VREG) {
+               error = EINVAL;
+               goto out;
+       }
+
        if ((error = vn_rdwr(UIO_READ, vp, (void *) &hdr, LINUX_AOUT_HDR_SIZE,
                             0, UIO_SYSSPACE, IO_NODELOCKED, l->l_cred,
                             &rem, NULL))) {



Home | Main Index | Thread Index | Old Index