lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250709171641.721b524a@kernel.org>
Date: Wed, 9 Jul 2025 17:16:41 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Kuniyuki Iwashima <kuniyu@...gle.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Andrew Lunn
 <andrew+netdev@...n.ch>, David Ahern <dsahern@...nel.org>, Simon Horman
 <horms@...nel.org>, Kuniyuki Iwashima <kuni1840@...il.com>,
 netdev@...r.kernel.org
Subject: Re: [PATCH v1 net-next] dev: Pass netdevice_tracker to
 dev_get_by_flags_rcu().

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ