Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108389231
D29524.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D29524.diff
View Options
diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c
--- a/sys/netinet/tcp_hostcache.c
+++ b/sys/netinet/tcp_hostcache.c
@@ -644,6 +644,7 @@
const int linesize = 128;
struct sbuf sb;
int i, error, len;
+ bool do_drain = false;
struct hc_metrics *hc_entry;
char ip4buf[INET_ADDRSTRLEN];
#ifdef INET6
@@ -701,9 +702,16 @@
hc_entry->rmx_hits,
hc_entry->rmx_updates,
hc_entry->rmx_expire);
+ do_drain = true;
}
THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx);
- sbuf_drain(&sb);
+ /* Need to track if sbuf has data, to avoid
+ * a KASSERT when calling sbuf_drain.
+ */
+ if (do_drain) {
+ sbuf_drain(&sb);
+ do_drain = false;
+ }
}
#undef msec
error = sbuf_finish(&sb);
@@ -769,7 +777,7 @@
KASSERT(V_tcp_hostcache.hashbase[i].hch_length > 0 &&
V_tcp_hostcache.hashbase[i].hch_length <=
V_tcp_hostcache.bucket_limit,
- ("tcp_hostcache: bucket langth out of range at %u: %u",
+ ("tcp_hostcache: bucket length out of range at %u: %u",
i, V_tcp_hostcache.hashbase[i].hch_length));
if (all || hc_entry->rmx_expire <= 0) {
TAILQ_REMOVE(&V_tcp_hostcache.hashbase[i].hch_bucket,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 25, 9:45 AM (16 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16136112
Default Alt Text
D29524.diff (1 KB)
Attached To
Mode
D29524: tcp: Shouldn't drain empty sbuf
Attached
Detach File
Event Timeline
Log In to Comment