diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2008-04-22 19:18:25 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2008-04-22 19:18:25 +0000 |
commit | 92ac69799c96e13f9d87e623f1514f7676494aaa (patch) | |
tree | 97c939a0d39d4c7b79714f3da3c723fb520235fa /sys/nfs | |
parent | 2915fbd714c07ab193dd8ded97ad618f1bc0f0aa (diff) |
Close potential mbuf leak by iterating over the mbuf packet chain
and m_freem()'ing vice doing so only on the first packet.
From a similar change in NetBSD.
"yes please" thib@
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_syscalls.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 06237958aad..478875fe9f8 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.57 2007/10/14 19:34:41 thib Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.58 2008/04/22 19:18:24 blambert Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -554,7 +554,7 @@ nfsrv_zapsock(slp) struct nfsrv_descript *nwp, *nnwp; struct socket *so; struct file *fp; - struct mbuf *m; + struct mbuf *m, *n; int s; slp->ns_flag &= ~SLP_ALLFLAGS; @@ -569,7 +569,12 @@ nfsrv_zapsock(slp) if (slp->ns_nam) MFREE(slp->ns_nam, m); m_freem(slp->ns_raw); - m_freem(slp->ns_rec); + m = slp->ns_rec; + while (m) { + n = m->m_nextpkt; + m_freem(m); + m = n; + } for (nuidp = TAILQ_FIRST(&slp->ns_uidlruhead); nuidp != NULL; nuidp = nnuidp) { nnuidp = TAILQ_NEXT(nuidp, nu_lru); |