Skip to contentSkip to conversation

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

PATCH Applied Alexandr Sapozhnkiov 4 participants 5 messages Oct 2, 2025 – Oct 6, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

From: Alexandr Sapozhnikov <[email protected]>

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.

---
 net/sctp/sm_statefuns.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/sctp/sm_statefuns.c +2 -1
index 5adf0c0a6c1a..056544e1ca15 100644
@@ -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:
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Alexandr Sapozhnkiov

From: Alexandr Sapozhnikov <[email protected]>

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.

Fixes 30f6ebf65bc4 ("sctp: add SCTP_AUTH_NO_AUTH type for

AUTHENTICATION_EVENT")

#4 lore raw
In reply to Alexandr Sapozhnkiov
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 2 Oct 2025 12:14:47 +0300 you wrote:

From: Alexandr Sapozhnikov <[email protected]>

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.

[...]

Here is the summary with links:
- net/sctp: fix a null dereference in sctp_disposition sctp_sf_do_5_1D_ce()

    https://git.kernel.org/netdev/net/c/2f3119686ef5

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html