Skip to contentSkip to conversation

sctp: fix null derefer in sctp_sf_do_5_1D_ce()

PATCH Applied Alexey Simakov 2 participants 2 messages Oct 9, 2025 – Oct 10, 2025

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

PATCH 1/1 sctp: fix null derefer in sctp_sf_do_5_1D_ce()

The check of new_asoc->peer.adaptation_ind can fail, leaving ai_ev unitilialized. In that case, the code can jump to the nomem_authdev label and later call sctp_ulpevent_free() with a null ai_ev pointer. Leading to potential null dereference.

Add check of ai_ev pointer before call of
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")
---
 net/sctp/sm_statefuns.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/sctp/sm_statefuns.c +2 -1
index a0524ba8d787..93cac73472c7 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 · 5 lines
2.34.1

I already have sent this patch from another email, but
he wasnt applicable since company mail server corrupt
it.
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 10 lines · On Thu, 9 Oct 2025 20:32:49 +0300 you wrote:

The check of new_asoc->peer.adaptation_ind can fail, leaving ai_ev unitilialized. In that case, the code can jump to the nomem_authdev label and later call sctp_ulpevent_free() with a null ai_ev pointer. Leading to potential null dereference.

Add check of ai_ev pointer before call of sctp_ulpevent_free function.

[...]

Here is the summary with links:
- sctp: fix null derefer in sctp_sf_do_5_1D_ce()

    https://git.kernel.org/netdev/net-next/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