From nobody Mon Jun 8 07:22:04 2026 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 BDF251E7660 for ; Mon, 1 Jun 2026 02:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780280421; cv=none; b=YXAB3HdioaPmENYZXgzP9fE/QPrfWJwJ8SgaIZ1Aa0hzTGSQVThHrwkdx1vCKSsPvGE3N8TS95edBAdNEYmHu3oCsJFEbnqfBaDW6TsG5toD45GbsPDdJ3NEKsVPaVMIeE8hQhRwQYzpnadtyQDlaZAMZ2IC7gTrreAMDsczdIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780280421; c=relaxed/simple; bh=8XquwNYqpoDi8pjPowgKuT/Kcn1pqiJjd54ju7qqiis=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=AArSRZpl0XxbQllw0JxwlNSQyI2j+C4uuaUrZg2iHT1KH4Y0TgqHQAHXNN6iYMkP1MgEueT6xpSWpHh6bDYUFIpWmcM794bhU1sawRiWXMcEbLgHIACodLG8p1gyps/r6NXOCce/r5u8ditlujQoDtuvL4d42BJ4TUL//hfBQqE= 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=GLM2IVEh; arc=none smtp.client-ip=209.85.216.45 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="GLM2IVEh" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-36bba9a1089so1474125a91.3 for ; Sun, 31 May 2026 19:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780280420; x=1780885220; 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=w3kT6GFrQd2hCnARBIk0tmZtMXSIFafPGJVXZeJkvOI=; b=GLM2IVEhNRsb+ejsd1JQc2LJGXFOHcPEqeh90zMhQVMaxUdHNnL2HUO60j+8W55y/j K61x1GguHxCCxZA9YzPKq2w95dutDFKORDdXjI0b/QFMTFS49HUYP3GS9NlNDweRyz4/ jtabp65UNLnHS15Am7GDvEy+DRgaPsw4viQEVIRiE/6fqG0bS2w3a/LkTFybja4z/0Bn o4mMi9tIQJDAZMpWiSQ9uF4VYWkFNSpwGaCNWywPkkx9209g5mcgwp2UgzGOvUNbg4UE a3oFwJ+c5nMncLek5PiW8c/awRI6yJLhs0rqhzfD2ePpzDTQXhJOYqgb1g45Usd+kRgq 0OPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780280420; x=1780885220; 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=w3kT6GFrQd2hCnARBIk0tmZtMXSIFafPGJVXZeJkvOI=; b=gLlHKLfEimv4h8DwEqVnVwhvPeWKdjS60Ec8+e3NsiXA9X1zeJ5mfcRMHJjZ6a9NFQ BhiSGyK0i3z7xuhFR+QqbjpVgTShQ6ZSO2Ngs5pq/x65iYji0bXiMsYPFo5InWZlSOk5 RSKjebFIXfPBsUN9VOQ+7s4LEwcIJswn2IwvCL+VGObSZ8+pcS+fSFl4apVdHD8mFzGf iAYj0RW0+LgSJZM6roxQAIFos5xD4fA1dTrz79OotZKy94LrVQcC00FJR7HYqAIhQ+a8 ay2wMaAi/j44lNE+d4cxPckiX1UMVeJutRxTPtLMCPtTU/fDYedIZmL06PVLbJthd1c6 l97Q== X-Forwarded-Encrypted: i=1; AFNElJ+ZnQanDXYINpbvBNI7fNxfVAgZSK3H6sad3AE6nSGHpdH9wuojlEr8o6YpIuG7KKcL6lEwox8jAdbaySw=@vger.kernel.org X-Gm-Message-State: AOJu0YyvtwK8PSY48nCtfp4DzG+2LskF1+fRiOZozGtiUZHzt0zUb2S6 rS20NUs6A5InwoqKVnG6LKsqElctULfQ/UvkyfwcYdqi6wXbuNUyrHd1 X-Gm-Gg: Acq92OGVPWpzyf+BFmJZKhQD0a0CS/5iNpP3XWz7aGfzys5wmS1lzUA13PNG9xLlPIl yS8CmwygBiiIjTbe2U066xJL9AP9qku3SmjxVTyA9BQsZbv9Xb/reoNGeSrs7ADbK6YIFeiKuql zD+oP99teiBBNbecmsiTpfsUsn1552pUwZkxfMBUNg2eoSu0AYVWGUM21o8Hp49PW45nmUgmGCU dWfwMNN3xwnPyXGl2DWrZ2QU8APOZ6PlsvRCj4jC/8bNMcS3KwnoXsRJkPiHSDrGsRcjx713s75 RSpAoqTH6Cpy+sl/WBU5ChLjB5xwTfxa7IsmAzvX95uKMdCBnOhNQOKyUJ9K8DJUeOk5j5fl4Ib vhSNKzRhaEMPEJ4p/n61WruFCKGChOgpYd0lkTi2kfomIVVFdXycfQit3lZEp7zPzFxoUVGLs2g HX6dZ03UM1Qr6n4mVTXRcpQXIIJuL5ACRKafTmHmW/DxaPO5HtmfRCV7zLYx4= X-Received: by 2002:a17:903:4b4c:b0:2bf:2243:d4ee with SMTP id d9443c01a7336-2bf368021a9mr102681195ad.18.1780280419974; Sun, 31 May 2026 19:20:19 -0700 (PDT) Received: from csl-conti-dell7858.ntu.edu.sg ([155.69.195.57]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bf23a10165sm85701235ad.31.2026.05.31.19.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2026 19:20:19 -0700 (PDT) From: Maoyi Xie To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: Fernando Fernandez Mancera , Jan Vaclav , Andrew Lunn , Taehee Yoo , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maoyi Xie Subject: [PATCH net-next v2] hsr: broadcast netlink notifications in the device's net namespace Date: Mon, 1 Jun 2026 10:20:14 +0800 Message-Id: <20260601022014.1175348-1-maoyixie.tju@gmail.com> X-Mailer: git-send-email 2.34.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 Content-Type: text/plain; charset="utf-8" The HSR generic netlink family sets .netnsok =3D true. HSR devices can live in network namespaces other than init_net. Two async notifiers broadcast events with genlmsg_multicast(). They are hsr_nl_ringerror() and hsr_nl_nodedown(). That helper delivers only on the default genl socket in init_net. So the events always land in init_net. The network namespace of the device does not matter. This has two effects. A listener in the device's own namespace never sees its own ring error and node down events. A privileged listener in init_net receives events from HSR devices in other namespaces. The payload carries the peer node MAC (HSR_A_NODE_ADDR) and the slave port ifindex (HSR_A_IFINDEX). Switch both callers to genlmsg_multicast_netns(). Other families with .netnsok =3D true already do this. Examples are gtp, ovpn, team, batman-adv, netdev-genl, ethtool and handshake. hsr_nl_ringerror() already has the slave port. It uses dev_net(port->dev). hsr_nl_nodedown() takes the namespace from the master port via hsr_port_get_hsr(). Reviewed-by: Fernando Fernandez Mancera Signed-off-by: Maoyi Xie --- v2: Drop the Fixes and stable tags and target net-next. As discussed, this is more of a behavior change than a fix, and the .netnsok commit has been in since 5.6 with no report. The multicast stays inside the rcu_read_lock, which avoids taking a netns ref on this path. Fernando's Reviewed-by carried over. Inquiry (2026-05-18): https://lore.kernel.org/netdev/CAHPEe=3DGO=3D2qqWZPwBB4rrXc3mkD0dznp2K78nCs= KwF=3Dc-QwxEw@mail.gmail.com/ v1 [PATCH net] (2026-05-27): https://lore.kernel.org/netdev/20260527075924.2707856-1-maoyixie.tju@gmail.= com/ net/hsr/hsr_netlink.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c index f0ca23da3ab9..eb6d222535d8 100644 --- a/net/hsr/hsr_netlink.c +++ b/net/hsr/hsr_netlink.c @@ -252,7 +252,8 @@ void hsr_nl_ringerror(struct hsr_priv *hsr, unsigned ch= ar addr[ETH_ALEN], goto nla_put_failure; =20 genlmsg_end(skb, msg_head); - genlmsg_multicast(&hsr_genl_family, skb, 0, 0, GFP_ATOMIC); + genlmsg_multicast_netns(&hsr_genl_family, dev_net(port->dev), + skb, 0, 0, GFP_ATOMIC); =20 return; =20 @@ -288,8 +289,17 @@ void hsr_nl_nodedown(struct hsr_priv *hsr, unsigned ch= ar addr[ETH_ALEN]) if (res < 0) goto nla_put_failure; =20 + rcu_read_lock(); + master =3D hsr_port_get_hsr(hsr, HSR_PT_MASTER); + if (!master) { + rcu_read_unlock(); + goto nla_put_failure; + } + genlmsg_end(skb, msg_head); - genlmsg_multicast(&hsr_genl_family, skb, 0, 0, GFP_ATOMIC); + genlmsg_multicast_netns(&hsr_genl_family, dev_net(master->dev), + skb, 0, 0, GFP_ATOMIC); + rcu_read_unlock(); =20 return; =20 --=20 2.34.1