Source-Changes-HG archive

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

[src/trunk]: src/sys/lkm/net/ethfoo/ethfoo Free mbufs as they're read instead...



details:   https://anonhg.NetBSD.org/src/rev/1561aec150e9
branches:  trunk
changeset: 571280:1561aec150e9
user:      cube <cube%NetBSD.org@localhost>
date:      Mon Nov 15 20:19:06 2004 +0000

description:
Free mbufs as they're read instead of leaking them.  Now qemu lets me do a
FTP install in tunfd network mode.

diffstat:

 sys/lkm/net/ethfoo/ethfoo/ethfoo_lkm.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 3ba1cf433cdc -r 1561aec150e9 sys/lkm/net/ethfoo/ethfoo/ethfoo_lkm.c
--- a/sys/lkm/net/ethfoo/ethfoo/ethfoo_lkm.c    Mon Nov 15 17:18:12 2004 +0000
+++ b/sys/lkm/net/ethfoo/ethfoo/ethfoo_lkm.c    Mon Nov 15 20:19:06 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ethfoo_lkm.c,v 1.6 2004/11/14 20:05:42 cube Exp $      */
+/*     $NetBSD: ethfoo_lkm.c,v 1.7 2004/11/15 20:19:06 cube Exp $      */
 
 /*
  *  Copyright (c) 2003, 2004 The NetBSD Foundation.
@@ -759,7 +759,7 @@
        struct ethfoo_softc *sc =
            (struct ethfoo_softc *)device_lookup(&ethfoo_cd, minor(dev));
        struct ifnet *ifp;
-       struct mbuf *m;
+       struct mbuf *m, *n;
        int error = 0, s;
 
        if (sc == NULL)
@@ -825,9 +825,13 @@
        do {
                error = uiomove(mtod(m, caddr_t),
                    min(m->m_len, uio->uio_resid), uio);
-               m = m->m_next;
+               MFREE(m, n);
+               m = n;
        } while (m != NULL && uio->uio_resid > 0 && error == 0);
 
+       if (m != NULL)
+               m_freem(m);
+
 out:
        (void)lockmgr(&sc->sc_rdlock, LK_RELEASE, NULL);
        return (error);



Home | Main Index | Thread Index | Old Index