From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B40B12E736B for ; Wed, 17 Jun 2026 14:49:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781707762; cv=none; b=h/CwhYZmofuUFKPyi5AW/ChREwQMuiP4XRcEcTqLIvJ9KM6aOSF7nDj5MQNBH+neLPUmY7TQD48IL6V2ZTBV5R4yDyWpXeyrS+pFjUDdV3rT0kEwYlhDHOOArEO86xVwrlWCAq2FB5T83wCee3l+kgLLP5WWbBzf4RgHOljCnJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781707762; c=relaxed/simple; bh=2mEWhKkYvCoxqAV4EaE/XMBtHtdRFtluNxbU7PsVflM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aNE1ooy5IFPx+C3ClIr1gldljfxPc0/LejjENzpxXyTDUzh7eht+0SzQHV7gzrjrRpd4AJxDEHF4NGU4jRogDiTI3IeOSHZ8egDDLJos+wpXP38GPs2FeutrWCd2JaAgIPGOMPUNGOCW3QqD0S2SJOoIcJCBwDkvzrvw0UtF2gM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gNP2diVb; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gNP2diVb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C584C1F000E9; Wed, 17 Jun 2026 14:49:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781707761; bh=SFBxBAhgXrRXmyfBFo/Vgy59o9Ged79mpgVK9YU+rgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gNP2diVb/HfbHguZ5FtjJSIOvSN714OeHrj68gwBiFVAykAuevbov1KOly5SBNLKA u9n1csoyGFI/QtShg8D3sI3JbWvuf0mk8iQ8cuUfSo6PP8uzbV/gw7GyAK5bzMZih1 SFOdc7TiTWkGRmwHDqD1xLmwzTtU+7d5xBZ9Pr04Iy2XSUifQXlZ6JmaWZJ7wqwEmd XE+xybwIfL6rY2M+ro8cZ9VJU7+WpGIMfbeE3Q3jTX1Z87NLi2qqIIbFVSLyRXXVJ+ NByKzGW3XYSpqeQ43bszzC9JXFPLmwd7FCACwtWkqvS7VtqskDOONLsRy9X9dA1AgK J2MeYl8WB9v1Q== From: Sasha Levin To: stable@vger.kernel.org Cc: Kuniyuki Iwashima , Eric Dumazet , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15.y 1/3] phonet: Pass ifindex to fill_addr(). Date: Wed, 17 Jun 2026 10:49:16 -0400 Message-ID: <20260617144918.39042-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026061547-discourse-faceless-4af5@gregkh> References: <2026061547-discourse-faceless-4af5@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Kuniyuki Iwashima [ Upstream commit 08a9572be36819b5d9011604edfa5db6c5062a7a ] We will convert addr_doit() and getaddr_dumpit() to RCU, both of which call fill_addr(). The former will call phonet_address_notify() outside of RCU due to GFP_KERNEL, so dev will not be available in fill_addr(). Let's pass ifindex directly to fill_addr(). Signed-off-by: Kuniyuki Iwashima Reviewed-by: Eric Dumazet Signed-off-by: Paolo Abeni Stable-dep-of: 71de0177b28d ("net: phonet: free phonet_device after RCU grace period") Signed-off-by: Sasha Levin --- net/phonet/pn_netlink.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c index dd4c7e9a634fbe..6b50e4d526682f 100644 --- a/net/phonet/pn_netlink.c +++ b/net/phonet/pn_netlink.c @@ -19,7 +19,7 @@ /* Device address handling */ -static int fill_addr(struct sk_buff *skb, struct net_device *dev, u8 addr, +static int fill_addr(struct sk_buff *skb, u32 ifindex, u8 addr, u32 portid, u32 seq, int event); void phonet_address_notify(int event, struct net_device *dev, u8 addr) @@ -31,7 +31,8 @@ void phonet_address_notify(int event, struct net_device *dev, u8 addr) nla_total_size(1), GFP_KERNEL); if (skb == NULL) goto errout; - err = fill_addr(skb, dev, addr, 0, 0, event); + + err = fill_addr(skb, dev->ifindex, addr, 0, 0, event); if (err < 0) { WARN_ON(err == -EMSGSIZE); kfree_skb(skb); @@ -92,8 +93,8 @@ static int addr_doit(struct sk_buff *skb, struct nlmsghdr *nlh, return err; } -static int fill_addr(struct sk_buff *skb, struct net_device *dev, u8 addr, - u32 portid, u32 seq, int event) +static int fill_addr(struct sk_buff *skb, u32 ifindex, u8 addr, + u32 portid, u32 seq, int event) { struct ifaddrmsg *ifm; struct nlmsghdr *nlh; @@ -107,7 +108,7 @@ static int fill_addr(struct sk_buff *skb, struct net_device *dev, u8 addr, ifm->ifa_prefixlen = 0; ifm->ifa_flags = IFA_F_PERMANENT; ifm->ifa_scope = RT_SCOPE_LINK; - ifm->ifa_index = dev->ifindex; + ifm->ifa_index = ifindex; if (nla_put_u8(skb, IFA_LOCAL, addr)) goto nla_put_failure; nlmsg_end(skb, nlh); @@ -140,7 +141,7 @@ static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb) if (addr_idx++ < addr_start_idx) continue; - if (fill_addr(skb, pnd->netdev, addr << 2, + if (fill_addr(skb, pnd->netdev->ifindex, addr << 2, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, RTM_NEWADDR) < 0) goto out; -- 2.53.0