From: Jakub Kicinski <kuba@kernel.org>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
David Ahern <dsahern@kernel.org>, Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH v1 net-next] dev: Pass netdevice_tracker to dev_get_by_flags_rcu().
Date: Wed, 9 Jul 2025 17:16:41 -0700 [thread overview]
Message-ID: <20250709171641.721b524a@kernel.org> (raw)
In-Reply-To: <20250709190144.659194-1-kuniyu@google.com>
On Wed, 9 Jul 2025 19:01:32 +0000 Kuniyuki Iwashima wrote:
> diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
> index 53cf68e0242bf..fa7f0c22167b4 100644
> --- a/net/ipv6/anycast.c
> +++ b/net/ipv6/anycast.c
> @@ -69,6 +69,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
> struct ipv6_pinfo *np = inet6_sk(sk);
> struct ipv6_ac_socklist *pac = NULL;
> struct net *net = sock_net(sk);
> + netdevice_tracker dev_tracker;
> struct net_device *dev = NULL;
> struct inet6_dev *idev;
> int err = 0, ishost;
> @@ -112,8 +113,8 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
> goto error;
> } else {
> /* router, no matching interface: just pick one */
> - dev = dev_get_by_flags_rcu(net, IFF_UP,
> - IFF_UP | IFF_LOOPBACK);
> + dev = netdev_get_by_flags_rcu(net, &dev_tracker, IFF_UP,
> + IFF_UP | IFF_LOOPBACK);
> }
> rcu_read_unlock();
> }
> @@ -159,7 +160,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
> error_idev:
> in6_dev_put(idev);
> error:
> - dev_put(dev);
> + netdev_put(dev, &dev_tracker);
Hmmm.. not sure this is legal.. We could have gotten the reference from
dev_get_by_index() or a bare dev_hold() -- I mean there are two other
ways of acquiring dev in this function. Either all or none of them
have to be tracker aware, we can't mix?
--
pw-bot: cr
next prev parent reply other threads:[~2025-07-10 0:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 19:01 [PATCH v1 net-next] dev: Pass netdevice_tracker to dev_get_by_flags_rcu() Kuniyuki Iwashima
2025-07-10 0:16 ` Jakub Kicinski [this message]
2025-07-10 1:38 ` Kuniyuki Iwashima
2025-07-10 21:51 ` kernel test robot
2025-07-10 23:05 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250709171641.721b524a@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuni1840@gmail.com \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).