Source-Changes-HG archive

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

[src/trunk]: src/sys/net Correct my rev1.159, it was incomplete, the check mu...



details:   https://anonhg.NetBSD.org/src/rev/d8be1e24af16
branches:  trunk
changeset: 1013488:d8be1e24af16
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Aug 29 07:14:50 2020 +0000

description:
Correct my rev1.159, it was incomplete, the check must be done later
because the value can change in the meantime (and get set to zero).

diffstat:

 sys/net/if_tun.c |  9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diffs (37 lines):

diff -r c753120add11 -r d8be1e24af16 sys/net/if_tun.c
--- a/sys/net/if_tun.c  Sat Aug 29 07:14:17 2020 +0000
+++ b/sys/net/if_tun.c  Sat Aug 29 07:14:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tun.c,v 1.159 2020/06/23 18:30:17 maxv Exp $        */
+/*     $NetBSD: if_tun.c,v 1.160 2020/08/29 07:14:50 maxv Exp $        */
 
 /*
  * Copyright (c) 1988, Julian Onions <jpo%cs.nott.ac.uk@localhost>
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.159 2020/06/23 18:30:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.160 2020/08/29 07:14:50 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -857,9 +857,6 @@
 
        TUNDEBUG("%s: tunwrite\n", ifp->if_xname);
 
-       if (uio->uio_resid == 0)
-               return 0;
-
        if (tp->tun_flags & TUN_PREPADDR) {
                if (uio->uio_resid < sizeof(dst)) {
                        error = EIO;
@@ -890,7 +887,7 @@
 #endif
        }
 
-       if (uio->uio_resid > TUNMTU) {
+       if (uio->uio_resid == 0 || uio->uio_resid > TUNMTU) {
                TUNDEBUG("%s: len=%lu!\n", ifp->if_xname,
                    (unsigned long)uio->uio_resid);
                error = EIO;



Home | Main Index | Thread Index | Old Index