diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-09-01 15:05:32 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-09-01 15:05:32 +0000 |
commit | 12f74acdeb1b3c509e5d628e1e838e1738ea082a (patch) | |
tree | b1cddabdd93422bcd10172a3790c6a941ac6e4bd /sys/nfs/nfs_socket.c | |
parent | aebafd059da2974a1bcbe5ec8c474a8c881b8ca9 (diff) |
Change sosetopt() to no longer free the mbuf it receives and change
all the callers to call m_freem(9).
Support from deraadt@ and tedu@, ok visa@, bluhm@
Diffstat (limited to 'sys/nfs/nfs_socket.c')
-rw-r--r-- | sys/nfs/nfs_socket.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index 2251b6fbf55..1b52fe1d804 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_socket.c,v 1.125 2017/08/14 16:56:57 tedu Exp $ */ +/* $OpenBSD: nfs_socket.c,v 1.126 2017/09/01 15:05:31 mpi Exp $ */ /* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */ /* @@ -270,6 +270,7 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) s = solock(so); error = sosetopt(so, IPPROTO_IP, IP_PORTRANGE, mopt); sounlock(s); + m_freem(mopt); if (error) goto bad; @@ -294,6 +295,7 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) s = solock(so); error = sosetopt(so, IPPROTO_IP, IP_PORTRANGE, mopt); sounlock(s); + m_freem(mopt); if (error) goto bad; } @@ -358,12 +360,14 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) *mtod(m, int32_t *) = 1; m->m_len = sizeof(int32_t); sosetopt(so, SOL_SOCKET, SO_KEEPALIVE, m); + m_freem(m); } if (so->so_proto->pr_protocol == IPPROTO_TCP) { MGET(m, M_WAIT, MT_SOOPTS); *mtod(m, int32_t *) = 1; m->m_len = sizeof(int32_t); sosetopt(so, IPPROTO_TCP, TCP_NODELAY, m); + m_freem(m); } sndreserve = (nmp->nm_wsize + NFS_MAXPKTHDR + sizeof (u_int32_t)) * 2; |