diff options
author | andre <andre@FreeBSD.org> | 2004-04-23 13:54:28 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2004-04-23 13:54:28 +0000 |
commit | e8723e5528fcaf8fa35c8432a0f4aedfe76cb723 (patch) | |
tree | dd9ffdc47005eb850fb17ea7f1e848e72987a975 /sys/netinet/tcp_hostcache.c | |
parent | 82d781d1b5098b0c10ef38c4d12369b205c0bd86 (diff) | |
download | FreeBSD-src-e8723e5528fcaf8fa35c8432a0f4aedfe76cb723.zip FreeBSD-src-e8723e5528fcaf8fa35c8432a0f4aedfe76cb723.tar.gz |
Fix a potential race when purging expired hostcache entries.
Spotted by: luigi
Diffstat (limited to 'sys/netinet/tcp_hostcache.c')
-rw-r--r-- | sys/netinet/tcp_hostcache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index ed7f9da..53fc7d9 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -700,7 +700,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) static void tcp_hc_purge(void *arg) { - struct hc_metrics *hc_entry; + struct hc_metrics *hc_entry, *hc_next; int all = (intptr_t)arg; int i; @@ -711,8 +711,8 @@ tcp_hc_purge(void *arg) for (i = 0; i < tcp_hostcache.hashsize; i++) { THC_LOCK(&tcp_hostcache.hashbase[i].hch_mtx); - TAILQ_FOREACH(hc_entry, &tcp_hostcache.hashbase[i].hch_bucket, - rmx_q) { + TAILQ_FOREACH_SAFE(hc_entry, &tcp_hostcache.hashbase[i].hch_bucket, + rmx_q, hc_next) { if (all || hc_entry->rmx_expire <= 0) { TAILQ_REMOVE(&tcp_hostcache.hashbase[i].hch_bucket, hc_entry, rmx_q); |