git: 986bc26c4e73 - releng/15.0 - unix/stream: fix instant panic w/o INVARIANTS
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 25 Aug 2026 16:00:59 UTC
The branch releng/15.0 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=986bc26c4e734af9f24d16fdc771ab2346c8e188
commit 986bc26c4e734af9f24d16fdc771ab2346c8e188
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-11-14 16:01:47 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-08-24 19:29:46 +0000
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.
Approved by: so
Security: FreeBSD-SA-26:57.unix
Pointy hat to: glebius
Fixes: 69f61cee2efb1eec0640ca7de9b2d51599569a5d
(cherry picked from commit 82d8a5029a80a77166dca098b8fedb10d84e4e38)
(cherry picked from commit 0f9fda8fb7b7f8c0fb7619a076a6c4b0dda0b67b)
---
sys/kern/uipc_usrreq.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index c9ba998a0777..ecf7218f2ca3 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;