diff options
author | wollman <wollman@FreeBSD.org> | 1995-09-13 17:54:03 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-09-13 17:54:03 +0000 |
commit | 65ee16fd5b2f6f097f2da06c4c388f102e1510c1 (patch) | |
tree | c864fcf4a5df2ac2f44631a5e4e8d571f537a1b7 /sys/netinet/tcp_usrreq.c | |
parent | 6158455f1ef2237e5a1fdea7f3e0f5fa6d9c538e (diff) | |
download | FreeBSD-src-65ee16fd5b2f6f097f2da06c4c388f102e1510c1.zip FreeBSD-src-65ee16fd5b2f6f097f2da06c4c388f102e1510c1.tar.gz |
Don't leak mbufs in an unusual error case in tcp_usrreq().
Reviewed by: Andras Olah <olah@freebsd.org>
Obtained from: Lite-2
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 2a74394..bb55c0f 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 - * $Id: tcp_usrreq.c,v 1.14.2.1 1995/06/09 03:21:13 davidg Exp $ + * $Id: tcp_usrreq.c,v 1.15 1995/06/11 19:31:43 rgrimes Exp $ */ #include <sys/param.h> @@ -93,7 +93,7 @@ tcp_usrreq(so, req, m, nam, control) #endif if (req == PRU_CONTROL) - return (in_control(so, (int)m, (caddr_t)nam, + return (in_control(so, (u_long)m, (caddr_t)nam, (struct ifnet *)control)); if (control && control->m_len) { m_freem(control); @@ -111,6 +111,18 @@ tcp_usrreq(so, req, m, nam, control) */ if (inp == 0 && req != PRU_ATTACH) { splx(s); +#if 0 + /* + * The following corrects an mbuf leak under rare + * circumstances, but has not been fully tested. + */ + if (m && req != PRU_SENSE) + m_freem(m); +#else + /* safer version of fix for mbuf leak */ + if (m && (req == PRU_SEND || req == PRU_SENDOOB)) + m_freem(m); +#endif return (EINVAL); /* XXX */ } if (inp) { |