From patchwork Wed Apr 17 14:58:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1924662 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VKPDX43Rrz1yZ2 for ; Thu, 18 Apr 2024 00:58:36 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rx6k0-0007Im-2N; Wed, 17 Apr 2024 14:58:28 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rx6jx-0007IX-KX for kernel-team@lists.ubuntu.com; Wed, 17 Apr 2024 14:58:25 +0000 Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 5EC723F85F for ; Wed, 17 Apr 2024 14:58:25 +0000 (UTC) Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-36b2225c6edso24638575ab.3 for ; Wed, 17 Apr 2024 07:58:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713365904; x=1713970704; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EBYmk25OWbgwkXyJMzp6ypAffS1JB+rs78xqnn6C3Mw=; b=IXmpaa3jqVOk/HwdUh3Zqf6NgUIFEO4quXI0z22Rc2V+/SSWV1kkT1UfBUet623lF6 N5/fY+ShQvAZJxwDQIduin61UNwjG+635T1mXdDA8rJXG5ViZlcE93l3TJ4dTXyu3Pgr h9j1G9TH0Srvo+uS+Qlq2ppj4wkcbU2bIr1I5iqQr9qnYApEAoRCBsgOGOzCDpR17vKo b+1/BzIH2xPaGNVyfxkHOyhCB1/dND2ta60YLePCHYOhSyEsDGWPRG/Z1JjPOEwzI0r5 WA4Y3dQnJuI3kD2uii88aaaBx+6JpTkXaLSKmtl4X8dpa5MLRt16G9tQovpgj5JEAOwL rDcg== X-Gm-Message-State: AOJu0YyKs2HJvl/2TxfF5VURVYYFVKoMa8sG3ypmZgoiwcbLmo+1fGK8 jQDs60b/7DuQHVUfSOJT7Xip1giOaxXe7DbyVgR5ygW2vmRTWCu+zVLlTDX6awkfRssoNzruQM0 vGqNvsTCHA/5R/0/NZco6csX2G59+N8nzdjwCuEi6RgYADaAvFAkp/KUxlraZinVzmyBC+GhbiV SwTzmhNxqD9g== X-Received: by 2002:a05:6e02:1c83:b0:36b:3a6e:ee84 with SMTP id w3-20020a056e021c8300b0036b3a6eee84mr1295397ill.11.1713365904051; Wed, 17 Apr 2024 07:58:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHharshC7uvPJU4pdIbT75PqRn3jsP+y6FZ5PDZGoSQuXRPa1OTTZ1Qs+Sr8MKN2Vcs2UjygQ== X-Received: by 2002:a05:6e02:1c83:b0:36b:3a6e:ee84 with SMTP id w3-20020a056e021c8300b0036b3a6eee84mr1295372ill.11.1713365903682; Wed, 17 Apr 2024 07:58:23 -0700 (PDT) Received: from smtp.gmail.com ([69.63.107.54]) by smtp.gmail.com with ESMTPSA id p11-20020a92d28b000000b0036a20dbcb17sm3759112ilp.16.2024.04.17.07.58.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 07:58:23 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][M/J][PATCH 1/1] ipv6: sr: fix possible use-after-free and null-ptr-deref Date: Wed, 17 Apr 2024 09:58:22 -0500 Message-Id: <20240417145822.9083-2-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240417145822.9083-1-bethany.jamison@canonical.com> References: <20240417145822.9083-1-bethany.jamison@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Vasiliy Kovalev [ Upstream commit 5559cea2d5aa3018a5f00dd2aca3427ba09b386b ] The pernet operations structure for the subsystem must be registered before registering the generic netlink family. Fixes: 915d7e5e5930 ("ipv6: sr: add code base for control plane support of SR-IPv6") Signed-off-by: Vasiliy Kovalev Link: https://lore.kernel.org/r/20240215202717.29815-1-kovalev@altlinux.org Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin (cherry picked from commit 9e02973dbc6a91e40aa4f5d87b8c47446fbfce44 linux-6.6.y) CVE-2024-26735 Signed-off-by: Bethany Jamison --- net/ipv6/seg6.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c index 29346a6eec9ff..35508abd76f43 100644 --- a/net/ipv6/seg6.c +++ b/net/ipv6/seg6.c @@ -512,22 +512,24 @@ int __init seg6_init(void) { int err; - err = genl_register_family(&seg6_genl_family); + err = register_pernet_subsys(&ip6_segments_ops); if (err) goto out; - err = register_pernet_subsys(&ip6_segments_ops); + err = genl_register_family(&seg6_genl_family); if (err) - goto out_unregister_genl; + goto out_unregister_pernet; #ifdef CONFIG_IPV6_SEG6_LWTUNNEL err = seg6_iptunnel_init(); if (err) - goto out_unregister_pernet; + goto out_unregister_genl; err = seg6_local_init(); - if (err) - goto out_unregister_pernet; + if (err) { + seg6_iptunnel_exit(); + goto out_unregister_genl; + } #endif #ifdef CONFIG_IPV6_SEG6_HMAC @@ -548,11 +550,11 @@ int __init seg6_init(void) #endif #endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL -out_unregister_pernet: - unregister_pernet_subsys(&ip6_segments_ops); -#endif out_unregister_genl: genl_unregister_family(&seg6_genl_family); +#endif +out_unregister_pernet: + unregister_pernet_subsys(&ip6_segments_ops); goto out; }