From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7BCCC1AC222; Thu, 6 Jun 2024 14:15:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717683307; cv=none; b=aYKH4OnjC2h//KaJ+OTViDHlMFSyTd+3eIDbfL+BxeQyU6iUwHOt4OxsB3TWA5KAz+39fP+AVVJOIDBeA1QtjivNAyGoKa+TH5AAQbBYgpygU8Pj76TW32SIocOXpbXbwWMpBDfagc/mhadSTDsfh7uX5KM2jJ89niNEByHWTPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717683307; c=relaxed/simple; bh=PnJAskMdDdn8Fx7zqF2e1/wi2VbhRuMMxevzjshaIkI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TmtoN8WeoTZ4PwnMygwGq6+x7ffEOXvIKDeW4ZyM3og6ViWNyjwZ/yM7N1rVY9XkYTNjTIE/e4iyhlCA669MXs4AHSczhTO9OZbBYVe/GkOm8xXUpWO7SJGwzD+MxoP+NDernK/WSD2OSG3NfmEu+7x8/RBd/0ctR/e5t+tW1mg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NGUpxBjs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NGUpxBjs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16F81C32781; Thu, 6 Jun 2024 14:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1717683307; bh=PnJAskMdDdn8Fx7zqF2e1/wi2VbhRuMMxevzjshaIkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGUpxBjs3Zm5Q74y94PrsI4fHuLi/CQM4ttrd0Fe4RCcNXmWjm9ju4fKmEye4dIea t1+79za/uOk/yKHpi/duKpOK9nNKEWVZRWB+AxG+qvSjlIZjb5+IfEwnK3skxXVRFX 24VqsLM2y/HSo2nwGkgdhtpXcbu84KiJZIOL28r8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guillaume Nault , Hangbin Liu , Sabrina Dubroca , David Ahern , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 248/744] ipv6: sr: fix invalid unregister error path Date: Thu, 6 Jun 2024 15:58:40 +0200 Message-ID: <20240606131740.357911196@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240606131732.440653204@linuxfoundation.org> References: <20240606131732.440653204@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hangbin Liu [ Upstream commit 160e9d2752181fcf18c662e74022d77d3164cd45 ] The error path of seg6_init() is wrong in case CONFIG_IPV6_SEG6_LWTUNNEL is not defined. In that case if seg6_hmac_init() fails, the genl_unregister_family() isn't called. This issue exist since commit 46738b1317e1 ("ipv6: sr: add option to control lwtunnel support"), and commit 5559cea2d5aa ("ipv6: sr: fix possible use-after-free and null-ptr-deref") replaced unregister_pernet_subsys() with genl_unregister_family() in this error path. Fixes: 46738b1317e1 ("ipv6: sr: add option to control lwtunnel support") Reported-by: Guillaume Nault Signed-off-by: Hangbin Liu Reviewed-by: Sabrina Dubroca Reviewed-by: David Ahern Link: https://lore.kernel.org/r/20240509131812.1662197-4-liuhangbin@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/seg6.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c index c4ef96c8fdaca..a31521e270f78 100644 --- a/net/ipv6/seg6.c +++ b/net/ipv6/seg6.c @@ -551,6 +551,8 @@ int __init seg6_init(void) #endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL out_unregister_genl: +#endif +#if IS_ENABLED(CONFIG_IPV6_SEG6_LWTUNNEL) || IS_ENABLED(CONFIG_IPV6_SEG6_HMAC) genl_unregister_family(&seg6_genl_family); #endif out_unregister_pernet: -- 2.43.0