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: <20231214181128.63793cdc@kernel.org>
Date: Thu, 14 Dec 2023 18:11:28 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Aurelien Aptel <aaptel@...dia.com>
Cc: linux-nvme@...ts.infradead.org, netdev@...r.kernel.org,
 sagi@...mberg.me, hch@....de, kbusch@...nel.org, axboe@...com,
 chaitanyak@...dia.com, davem@...emloft.net, aurelien.aptel@...il.com,
 smalin@...dia.com, malin1024@...il.com, ogerlitz@...dia.com,
 yorayz@...dia.com, borisp@...dia.com, galshalom@...dia.com,
 mgurtovoy@...dia.com, edumazet@...gle.com, pabeni@...hat.com,
 john.fastabend@...il.com, daniel@...earbox.net
Subject: Re: [PATCH v21 04/20] net/tls,core: export get_netdev_for_sock

On Thu, 14 Dec 2023 13:26:07 +0000 Aurelien Aptel wrote:
> -struct net_device *netdev_sk_get_lowest_dev(struct net_device *dev,
> -					    struct sock *sk)
> +struct net_device *get_netdev_for_sock(struct sock *sk)
>  {
> -	struct net_device *lower;
> +	struct dst_entry *dst = sk_dst_get(sk);
> +	struct net_device *dev, *lower;
>  
> -	lower = netdev_sk_get_lower_dev(dev, sk);
> -	while (lower) {
> +	if (unlikely(!dst))
> +		return NULL;
> +	dev = dst->dev;
> +	while ((lower = netdev_sk_get_lower_dev(dev, sk)))
>  		dev = lower;
> -		lower = netdev_sk_get_lower_dev(dev, sk);
> -	}
> -
> +	dev_hold(dev);
> +	dst_release(dst);
>  	return dev;
>  }
> -EXPORT_SYMBOL(netdev_sk_get_lowest_dev);
> +EXPORT_SYMBOL_GPL(get_netdev_for_sock);

Since the use of this helper is now spreading we should
switch it to netdev_hold and have the caller pass in a
netdevice_tracker.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ