netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sctp: fix null derefer in sctp_sf_do_5_1D_ce()
@ 2025-10-09 17:32 Alexey Simakov
  2025-10-10  8:37 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Simakov @ 2025-10-09 17:32 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: Alexey Simakov, Xin Long, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, linux-sctp, netdev,
	linux-kernel, lvc-project

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")
Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
---
 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 a0524ba8d787..93cac73472c7 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.34.1

I already have sent this patch from another email, but
he wasnt applicable since company mail server corrupt
it.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sctp: fix null derefer in sctp_sf_do_5_1D_ce()
  2025-10-09 17:32 [PATCH] sctp: fix null derefer in sctp_sf_do_5_1D_ce() Alexey Simakov
@ 2025-10-10  8:37 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-10  8:37 UTC (permalink / raw)
  To: Alexey Simakov
  Cc: marcelo.leitner, lucien.xin, davem, edumazet, kuba, pabeni, horms,
	linux-sctp, netdev, linux-kernel, lvc-project

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-10  8:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 17:32 [PATCH] sctp: fix null derefer in sctp_sf_do_5_1D_ce() Alexey Simakov
2025-10-10  8:37 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).