From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E75023EAB4 for ; Thu, 14 May 2026 00:22:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778718145; cv=none; b=X8IQr6NQf9j66fmPXnPPG1PSQk8+9HjJqYZFBgqc6n1jNMWTLra6dxBVDKOaQnqmBffSHy7XvlKZyflZTqVMvfP2kG9pxZGkjCI3T3bCuI52ZqeKmTFIfd4EDOKGqfx5F9cBtsy8sh2YO3uGIR16xQ1armBI5A9jIn8955/P9zA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778718145; c=relaxed/simple; bh=r/dNhDtuahypA87C1YXJ4TllXHta2MJW4yZ//T4QsQI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=n0yxqLunt2v7C/hcTGu0zoq6ZZF0SAaBl85lDVQxeyN0grH+HozAv9rmlcerluSXt2pFfoxSGNsM0+33h6MP4dlnOSazGZGSNjSZ0biSzs3++p5qqR8/Kyi6C3rvrfjUXwkymvsnImlEAfTBHWiJc/TNtNJ/YVZ5nVSsGEGZYU8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GlfHwn5a; arc=none smtp.client-ip=209.85.222.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GlfHwn5a" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-8d65f4073bfso995132985a.3 for ; Wed, 13 May 2026 17:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778718142; x=1779322942; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=irXLMVW2G6pZT9ipRR8zg24QGfQC3eyv0or3evjGwyA=; b=GlfHwn5aFaBo7uk+qB/5vco06qJa/pfRvDUCAL14cFaPS7yA0cfpLRCWcPvMriCX7v MhzqE3MEmSwLvh9dUKoXyUmYDeBlvKg20t+HmEYNG5ZcfCtD/Zp0cAsJ+S/aBg9uCkUm THHhtwTlu0vOWI9SJZNL8oaXlSrYQwvSV6cPxevdPGwhRrh5sBu5b12iW5gyU3S/V7/r YZVlU8lNnI3cjHWbzfJZlBLp07KJ99depG58DStEEugJ3Z7jNEhTAnQXtOhu8E2WYUoJ 7TLslYZmHB1bpJ1jsabKCNwo7OwegJUgRGLXKkc0osFZbVR1axzvdCyvM2M1gRTJaMi5 v6jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778718142; x=1779322942; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=irXLMVW2G6pZT9ipRR8zg24QGfQC3eyv0or3evjGwyA=; b=JhgNfPqu1pWsDW8WYCUT/keYehwwduNstMEPwkz4/D+srBqfZ6rHTpcberGXA552/p fzJ99T4N15jbzgfS54gOmyi5zmLaQrkEz9oY/hPsqo1uN5waVNvauDgrCGyUguyuYsGh FNBBY1UnOxZ8w7T56ftnDUuXkNH615b7vDvqNQKsOQmxxjMdwahm3cEDVOpLnGOuPK8M xpzFiPG8lEu61ZgPgRcpG4OgOIrzqWEb7vfd/A7jVNJeUebx8PlEnXDCO6fnrG5IM9Ke /yCdE1SfHqaFoRudgDpuR1EReG3hh8gRqkw+CrORL1tqUORjpwlPwv5dZ1RPJaplFQoL py9g== X-Forwarded-Encrypted: i=1; AFNElJ8IwusNEl/Q7BGBfbwi5ScsrC5wWoygO0PscgJNo4mrOFyWxFkBwxIntObSn/ygxBjvlTncajYntLwn65I=@vger.kernel.org X-Gm-Message-State: AOJu0Yypg6gkngxZFGb7k95K05OwvJf+Q+nVDEbVeiMC0NjiDoQqeo5p hdTvna8LAq6aAh1+p1/l76yszI7lUoCWPgy2bcGAMGicGloJKA5EuTMAktf6PJF7cbmOkg== X-Gm-Gg: Acq92OFdcVsmGsjh0mnsvdHAQUblytnhVZvkB182uM8RJTmbQTj1CN/NkOEwREFMZng HUyukIzjkc7RHrUuzSzWH6X0CXaPhw7Y2FVI6syfm+Qz997nOVXaDCAt5z6/1wEn4kauSvbLbsV mhtR0tOdzRsrIJYrp6+Yoc4fwOOsbAuet9fAbN6xyiolyQWTNcrJNdjvtIvaruMTMFbPCykplHZ xbcGWIbr2DTRTPwKjkJ4qvZTdk0SmzncPu+2wxjUn3Z1rJKGeCvsr5UzGNLPENl9DlSuS56eWc/ eaetljMX/Gr90ApG0ulNWuk8GrG2q7z3MOWhQRTToODNxxNpgW6LxY0XQTGhOcIz8L5pYYDq6rp YDfWBA2n2g/lrSavV8eltL8Pse+F4vqbuOAmpy2XU/4dI+kHQSQ5De6rAtsh3Y9V7lPQHkDutxj FJvB+zEZQWmRY8NcqSfYKEjuJmt+qlc3t+ODaZNT31 X-Received: by 2002:a05:620a:4506:b0:90d:3af3:2a62 with SMTP id af79cd13be357-90f8a827302mr897456985a.46.1778718142168; Wed, 13 May 2026 17:22:22 -0700 (PDT) Received: from i4-gl-tmk5904.ad.psu.edu ([130.203.156.186]) by smtp.gmail.com with ESMTPSA id af79cd13be357-910bcf3776dsm107829585a.39.2026.05.13.17.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 17:22:21 -0700 (PDT) From: Yuho Choi To: "David S . Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yuho Choi Subject: [PATCH v1] ipv6: route: Unregister netdevice notifier on BPF init failure Date: Wed, 13 May 2026 20:22:18 -0400 Message-ID: <20260514002218.677943-1-dbgh9129@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ip6_route_init() registers ip6_route_dev_notifier before registering the IPv6 route BPF iterator target. If bpf_iter_register() fails, the error path jumps to out_register_late_subsys and unwinds the RTNL handlers and late pernet subsystem, but leaves the netdevice notifier registered. Add a separate unwind label for the BPF iterator failure path so the netdevice notifier is unregistered before continuing with the existing cleanup. Fixes: 138d0be35b14 ("net: bpf: Add netlink and ipv6_route bpf_iter targets") Signed-off-by: Yuho Choi --- net/ipv6/route.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index cb521700cee7..4333e11dc9c5 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -6925,7 +6925,7 @@ int __init ip6_route_init(void) #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS) ret = bpf_iter_register(); if (ret) - goto out_register_late_subsys; + goto out_register_notifier; #endif #endif @@ -6939,6 +6939,12 @@ int __init ip6_route_init(void) out: return ret; +#if IS_BUILTIN(CONFIG_IPV6) +#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS) +out_register_notifier: + unregister_netdevice_notifier(&ip6_route_dev_notifier); +#endif +#endif out_register_late_subsys: rtnl_unregister_all(PF_INET6); unregister_pernet_subsys(&ip6_route_net_late_ops); -- 2.43.0