summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorGrigoriy Orlov <gluk@cvs.openbsd.org>2001-03-25 12:03:12 +0000
committerGrigoriy Orlov <gluk@cvs.openbsd.org>2001-03-25 12:03:12 +0000
commit9f5c0ef09417f4e79eb7c0763979ab938c7259cb (patch)
tree6fe28b2b3b41e5dc9426723645bd6c19e048e9cf /sys/netinet
parent13ed998024a6abd18bc9cb60d04c38eced185ca8 (diff)
Protect KFREES by splnet and rearrange pointers. This fix interrupt
race between ipllog() and ipflog_read() which caused a memory leak and "Data modified on freelist" error. fgsch@ ok.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_log.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/netinet/ip_log.c b/sys/netinet/ip_log.c
index a5d696631cb..c9a14531c9e 100644
--- a/sys/netinet/ip_log.c
+++ b/sys/netinet/ip_log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_log.c,v 1.10 2001/01/30 04:23:56 kjell Exp $ */
+/* $OpenBSD: ip_log.c,v 1.11 2001/03/25 12:03:11 gluk Exp $ */
/*
* Copyright (C) 1997-2000 by Darren Reed.
@@ -446,22 +446,19 @@ struct uio *uio;
/*
* Don't hold the mutex over the uiomove call.
*/
- iplt[unit] = ipl->ipl_next;
- iplused[unit] -= dlen;
MUTEX_EXIT(&ipl_mutex);
SPL_X(s);
error = UIOMOVE((caddr_t)ipl, dlen, UIO_READ, uio);
if (error) {
SPL_NET(s);
MUTEX_ENTER(&ipl_mutex);
- ipl->ipl_next = iplt[unit];
- iplt[unit] = ipl;
- iplused[unit] += dlen;
break;
}
- KFREES((caddr_t)ipl, dlen);
SPL_NET(s);
MUTEX_ENTER(&ipl_mutex);
+ iplused[unit] -= dlen;
+ iplt[unit] = ipl->ipl_next;
+ KFREES((caddr_t)ipl, dlen);
}
if (!iplt[unit]) {
iplused[unit] = 0;