Thread (5 messages) 5 messages, 4 authors, 2025-10-06
STALE286d

[PATCH] net/sctp: fix a null dereference in sctp_disposition sctp_sf_do_5_1D_ce()

From: Alexandr Sapozhnkiov <hidden>
Date: 2025-10-02 09:14:53
Also in: linux-sctp, lkml
Subsystem: networking [general], sctp protocol, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Marcelo Ricardo Leitner, Xin Long, Linus Torvalds

From: Alexandr Sapozhnikov <redacted>

If new_asoc->peer.adaptation_ind=0 and sctp_ulpevent_make_authkey=0 
and sctp_ulpevent_make_authkey() returns 0, then the variable 
ai_ev remains zero and the zero will be dereferenced 
in the sctp_ulpevent_free() function.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Alexandr Sapozhnikov <redacted>
---
 net/sctp/sm_statefuns.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 5adf0c0a6c1a..056544e1ca15 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -885,7 +885,8 @@ enum sctp_disposition sctp_sf_do_5_1D_ce(struct net *net,
 	return SCTP_DISPOSITION_CONSUME;
 
 nomem_authev:
-	sctp_ulpevent_free(ai_ev);
+	if (ai_ev)
+		sctp_ulpevent_free(ai_ev);
 nomem_aiev:
 	sctp_ulpevent_free(ev);
 nomem_ev:
-- 
2.43.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help