aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2025-11-14 16:01:47 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2025-11-14 16:01:47 +0000
commit82d8a5029a80a77166dca098b8fedb10d84e4e38 (patch)
tree60aa3b50bdbbc7f2d7f1fd1a7da2a92a22754910
parentb0c1ead2b9be0f6aa5a715d849b9ca7af093b513 (diff)
unix/stream: fix instant panic w/o INVARIANTS
A stupid microoptimization I made leaving empty STAILQ inconsistent is a brainfart that is related to much earlier version of this code, where it was safe to do so. Pointy hat to: glebius Fixes: 69f61cee2efb1eec0640ca7de9b2d51599569a5d
-rw-r--r--sys/kern/uipc_usrreq.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index b1cb6de98b5b..6996f3d447bd 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1492,11 +1492,10 @@ restart:
}
if (!peek) {
- STAILQ_FIRST(&sb->uxst_mbq) = next;
-#ifdef INVARIANTS
if (next == NULL)
STAILQ_INIT(&sb->uxst_mbq);
-#endif
+ else
+ STAILQ_FIRST(&sb->uxst_mbq) = next;
MPASS(sb->sb_acc >= datalen);
sb->sb_acc -= datalen;
sb->sb_ccc -= datalen;