Source-Changes-HG archive

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

[src/trunk]: src/sys/kern The sanity check prevented messages that carry only...



details:   https://anonhg.NetBSD.org/src/rev/2f2ff9ccaa80
branches:  trunk
changeset: 783568:2f2ff9ccaa80
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Dec 29 18:51:39 2012 +0000

description:
The sanity check prevented messages that carry only ancillary data.

diffstat:

 sys/kern/uipc_syscalls.c |  18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diffs (60 lines):

diff -r e8ec6543adcd -r 2f2ff9ccaa80 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Sat Dec 29 16:18:08 2012 +0000
+++ b/sys/kern/uipc_syscalls.c  Sat Dec 29 18:51:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.157 2012/12/29 10:22:40 mlelstv Exp $      */
+/*     $NetBSD: uipc_syscalls.c,v 1.158 2012/12/29 18:51:39 mlelstv Exp $      */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.157 2012/12/29 10:22:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.158 2012/12/29 18:51:39 mlelstv Exp $");
 
 #include "opt_pipe.h"
 
@@ -547,11 +547,6 @@
        control = (mp->msg_flags & MSG_CONTROLMBUF) ? mp->msg_control : NULL;
        iovsz = mp->msg_iovlen * sizeof(struct iovec);
 
-       if (iovsz <= 0) {
-               error = EMSGSIZE;
-               goto bad;
-       }
-
        if (mp->msg_flags & MSG_IOVUSRSPACE) {
                if ((unsigned int)mp->msg_iovlen > UIO_SMALLIOV) {
                        if ((unsigned int)mp->msg_iovlen > IOV_MAX) {
@@ -609,7 +604,7 @@
                }
        }
 
-       if (ktrpoint(KTR_GENIO)) {
+       if (ktrpoint(KTR_GENIO) && iovsz > 0) {
                ktriov = kmem_alloc(iovsz, KM_SLEEP);
                memcpy(ktriov, auio.uio_iov, iovsz);
        }
@@ -915,11 +910,6 @@
 
        iovsz = mp->msg_iovlen * sizeof(struct iovec);
 
-       if (iovsz <= 0) {
-               error = EMSGSIZE;
-               goto out;
-       }
-
        if (mp->msg_flags & MSG_IOVUSRSPACE) {
                if ((unsigned int)mp->msg_iovlen > UIO_SMALLIOV) {
                        if ((unsigned int)mp->msg_iovlen > IOV_MAX) {
@@ -957,7 +947,7 @@
                }
        }
 
-       if (ktrpoint(KTR_GENIO)) {
+       if (ktrpoint(KTR_GENIO) && iovsz > 0) {
                ktriov = kmem_alloc(iovsz, KM_SLEEP);
                memcpy(ktriov, auio.uio_iov, iovsz);
        }



Home | Main Index | Thread Index | Old Index