From nobody Thu Oct 2 05:05:14 2025 Received: from MSK-MAILEDGE.securitycode.ru (msk-mailedge.securitycode.ru [195.133.217.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D6803115BB for ; Mon, 22 Sep 2025 16:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.133.217.143 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758558742; cv=none; b=a1jPzL9OdfXFEDIRi1tpIrDneHomWMYV3W9jIEBJPd+/JAa344+6RH8+rWsM6LRy94bWIG2wSgTTQvjqXU9tBNLx6SCPeN3uJ5fVHxqC0aqQMRZI+axK3IP3my4rqUnmK/dWGTgJZ104MlMfnN2L4tkfYPbrAbBGbgsTBlPiM6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758558742; c=relaxed/simple; bh=L+1GpczOXpwStUSxO6lxxywZlkszQxq/Sca4B3MQJto=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=XKGDauH0UkaEEv9Y1vnhgxK31A7lTH1WGyGpjVCJPaDJBPiv/bJOqP0lSNpySa753lgIuPyIf7O/lNDIA5ITnSAqOX2rH7UyxmEY8xc2ZsI1D0Y7GEK9BipUr97MQfOQ2gj/PjrsTnPSiDBkTDzh8b+vA5DzgNQjItQggb6gAv8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=securitycode.ru; spf=pass smtp.mailfrom=securitycode.ru; arc=none smtp.client-ip=195.133.217.143 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=securitycode.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=securitycode.ru From: Alexey Simakov To: CC: Alexey Simakov , , , , , , , , , , Subject: [PATCH] sctp: fix null deref in sctp_sf_do_5_1D_ce() Date: Mon, 22 Sep 2025 19:15:55 +0300 Message-ID: <20250922161557.2716-2-a.simakov@securitycode.ru> X-Mailer: git-send-email 2.43.0.windows.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SPB-EX1.Securitycode.ru (172.16.24.91) To MSK-EX2.Securitycode.ru (172.17.8.92) Content-Type: text/plain; charset="utf-8" The check of new_asoc->peer.adaptation_ind can fail, leaving ai_ev uninitialized. 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 a 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_E= VENT") Signed-off-by: Alexey Simakov --- 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 *ne= t, return SCTP_DISPOSITION_CONSUME; =20 nomem_authev: - sctp_ulpevent_free(ai_ev); + if (ai_ev) + sctp_ulpevent_free(ai_ev); nomem_aiev: sctp_ulpevent_free(ev); nomem_ev: --=20 2.34.1