fix ipqent pool corruption problems. make tcp reass code use

its own pool of ipqent rather than sharing it with ip reass code.
PR/24782.
This commit is contained in:
yamt 2004-09-15 09:21:22 +00:00
parent f3872a35ff
commit 0ea22c32fa
3 changed files with 15 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_input.c,v 1.208 2004/06/26 03:29:15 itojun Exp $ */
/* $NetBSD: tcp_input.c,v 1.209 2004/09/15 09:21:22 yamt Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.208 2004/06/26 03:29:15 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.209 2004/09/15 09:21:22 yamt Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -347,6 +347,8 @@ static void tcp6_log_refused
#define TRAVERSE(x) while ((x)->m_next) (x) = (x)->m_next
POOL_INIT(tcpipqent_pool, sizeof(struct ipqent), 0, 0, 0, "tcpipqepl", NULL);
int
tcp_reass(tp, th, m, tlen)
struct tcpcb *tp;
@ -498,7 +500,7 @@ tcp_reass(tp, th, m, tlen)
tcpstat.tcps_rcvdupbyte += pkt_len;
m_freem(m);
if (tiqe != NULL)
pool_put(&ipqent_pool, tiqe);
pool_put(&tcpipqent_pool, tiqe);
TCP_REASS_COUNTER_INCR(&tcp_reass_segdup);
return (0);
}
@ -578,7 +580,7 @@ tcp_reass(tp, th, m, tlen)
if (tiqe == NULL)
tiqe = q;
else
pool_put(&ipqent_pool, q);
pool_put(&tcpipqent_pool, q);
TCP_REASS_COUNTER_INCR(&tcp_reass_prepend);
break;
}
@ -603,7 +605,7 @@ tcp_reass(tp, th, m, tlen)
if (tiqe == NULL)
tiqe = q;
else
pool_put(&ipqent_pool, q);
pool_put(&tcpipqent_pool, q);
}
#ifdef TCP_REASS_COUNTERS
@ -623,7 +625,7 @@ tcp_reass(tp, th, m, tlen)
* XXX If we can't, just drop the packet. XXX
*/
if (tiqe == NULL) {
tiqe = pool_get(&ipqent_pool, PR_NOWAIT);
tiqe = pool_get(&tcpipqent_pool, PR_NOWAIT);
if (tiqe == NULL) {
tcpstat.tcps_rcvmemdrop++;
m_freem(m);
@ -692,7 +694,7 @@ present:
m_freem(q->ipqe_m);
else
sbappendstream(&so->so_rcv, q->ipqe_m);
pool_put(&ipqent_pool, q);
pool_put(&tcpipqent_pool, q);
sorwakeup(so);
return (pkt_flags);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_subr.c,v 1.172 2004/05/18 14:44:14 itojun Exp $ */
/* $NetBSD: tcp_subr.c,v 1.173 2004/09/15 09:21:22 yamt Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.172 2004/05/18 14:44:14 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.173 2004/09/15 09:21:22 yamt Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -1244,7 +1244,7 @@ tcp_freeq(tp)
TAILQ_REMOVE(&tp->segq, qe, ipqe_q);
TAILQ_REMOVE(&tp->timeq, qe, ipqe_timeq);
m_freem(qe->ipqe_m);
pool_put(&ipqent_pool, qe);
pool_put(&tcpipqent_pool, qe);
rv = 1;
}
return (rv);

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_var.h,v 1.112 2004/05/18 14:44:16 itojun Exp $ */
/* $NetBSD: tcp_var.h,v 1.113 2004/09/15 09:21:22 yamt Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -684,6 +684,8 @@ extern int tcp_syn_cache_size;
extern struct syn_cache_head tcp_syn_cache[];
extern u_long syn_cache_count;
extern struct pool tcpipqent_pool;
#ifdef MBUFTRACE
extern struct mowner tcp_rx_mowner;
extern struct mowner tcp_tx_mowner;