git: d1cbb17a873c - main - unix: fix the ad hoc STAILQ_PREPEND()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 Apr 2024 00:03:56 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=d1cbb17a873c787a527316bbb27551e97d5ad30c
commit d1cbb17a873c787a527316bbb27551e97d5ad30c
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-04-09 00:02:00 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-04-09 00:02:00 +0000
unix: fix the ad hoc STAILQ_PREPEND()
If there is nothing to prepend, don't try STAILQ_INSERT_HEAD().
Fixes: d80a97def9a1db6f07f5d2e68f7ad62b27918947
Reported-by: syzbot+bb7f3d07c79b5faf8de8@syzkaller.appspotmail.com
---
sys/kern/uipc_usrreq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 1b9416269696..d1f32cf3d711 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1368,7 +1368,8 @@ restart:
UIPC_STREAM_SBCHECK(sb);
MPASS(!(sb->sb_state & SBS_CANTRCVMORE));
/* XXXGL: STAILQ_PREPEND */
- if (STAILQ_EMPTY(&sb->sb_mbq))
+ if (STAILQ_EMPTY(&sb->sb_mbq) &&
+ control != NULL)
STAILQ_INSERT_HEAD(&sb->sb_mbq,
control, m_stailq);
else