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 9D4D91EEF7; Mon, 27 May 2024 19:32:18 +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=1716838338; cv=none; b=N9czpdiug/CaV3bUo81Hua0QSIOyy30p5z/DYQB0AX0sIhcONaq4wS/6f2gPv0oZufBZ3qtu1LcE1B9UERMxGidNTLuoehZD23+0rA23yI8jZiprPDCSji8GyD+fu4CnqQ60xSigxtjY9keyth3RjRo+2Q9PBIaAD+66p+AIv2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716838338; c=relaxed/simple; bh=ETnU3GoxeoQW0xkiqThsedzaqJWnW+H2U48dSC7rRnI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UoRBO523sV5rfeFlLapS6ZfV/5mVwpNTVDNxlsWIf33ltnKkQ3EpKrachGFbfsqC2W3aYGgVA8X6Cz5e62B/EUclyO7nME6jSFrDfp8KrClkHpDgDKd+6O3zOQdyxtz8FgzGAjJoSLcnP34WDe+3t23MhYJRoqgiM8UyHVNiXY0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kBJnetA7; 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="kBJnetA7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32448C2BBFC; Mon, 27 May 2024 19:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716838338; bh=ETnU3GoxeoQW0xkiqThsedzaqJWnW+H2U48dSC7rRnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kBJnetA7iv9TauUxNytMJsOSbAo230p1D15YkKs8eI1VQFNxY3iR5DrE0m0aZM7Yw KH6ga1gU7+l4nERqJTypnXVoI0Cg2hnAQoA2EXb6HuwDhif4XPkmhxR8Qo1eZZC9HU C6tLkxQc+3qX76J23IgNtwnZ/i/BWswY8psszm0k= 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.8 314/493] ipv6: sr: fix invalid unregister error path Date: Mon, 27 May 2024 20:55:16 +0200 Message-ID: <20240527185640.560646833@linuxfoundation.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240527185626.546110716@linuxfoundation.org> References: <20240527185626.546110716@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.8-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