socket: Don't assume m0 != NULL in sbappendcontrol_locked()

Some callers (e.g., ktls_decrypt()) violate this assumption and thus
could trigger a NULL pointer dereference in KMSAN kernels.

Reported by:	glebius
Fixes:		ec45f952a2 ("sockbuf: Add KMSAN checks to sbappend*()")
MFC after:	1 week
This commit is contained in:
Mark Johnston 2024-02-02 13:58:37 -05:00
parent d3d0b73557
commit 30f8cb812e

View File

@ -1326,7 +1326,8 @@ sbappendcontrol_locked(struct sockbuf *sb, struct mbuf *m0,
{
struct mbuf *m, *mlast;
kmsan_check_mbuf(m0, "sbappend");
if (m0 != NULL)
kmsan_check_mbuf(m0, "sbappend");
kmsan_check_mbuf(control, "sbappend");
sbm_clrprotoflags(m0, flags);