unix/stream: fix instant panic w/o INVARIANTS
Some checks are pending
Cross-build Kernel / aarch64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / amd64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / amd64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / amd64 macos-latest (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 macos-latest (clang-18) (push) Waiting to run

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:		69f61cee2e
This commit is contained in:
Gleb Smirnoff 2025-11-14 08:01:47 -08:00
parent b0c1ead2b9
commit 82d8a5029a

View file

@ -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;