sctp: fix null derefer in sctp_sf_do_5_1D_ce()
Subsystems (3)
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 ofsctp_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
@@ -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.
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_indcan fail, leavingai_evunitilialized. In that case, the code can jump to thenomem_authdevlabel and later callsctp_ulpevent_free()with a nullai_evpointer. Leading to potential null dereference.Add check of
ai_evpointer before call ofsctp_ulpevent_freefunction.[...]
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