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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 8 Dec 2020 15:49:05 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Lijun Pan <ljp@...ux.ibm.com>
Cc:     netdev@...r.kernel.org, Nathan Lynch <nathanl@...ux.ibm.com>
Subject: Re: [RFC PATCH net-next 1/3] net: core: introduce
 netdev_notify_peers_locked

On Sat,  5 Dec 2020 23:21:25 -0600 Lijun Pan wrote:
> There are some use cases for netdev_notify_peers in the context
> when rtnl lock is already held. Introduce lockless version
> of netdev_notify_peers call to save the extra code to call
> 	call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev);
> 	call_netdevice_notifiers(NETDEV_RESEND_IGMP, dev);
> 
> Suggested-by: Nathan Lynch <nathanl@...ux.ibm.com>
> Signed-off-by: Lijun Pan <ljp@...ux.ibm.com>

> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1488,6 +1488,25 @@ void netdev_notify_peers(struct net_device *dev)
>  }
>  EXPORT_SYMBOL(netdev_notify_peers);

Why not convert netdev_notify_peers to call the new helper?
That way the chance they will get out of sync is way smaller.

> +/**
> + * netdev_notify_peers_locked - notify network peers about existence of @dev,
> + * to be called in the context when rtnl lock is already held.
> + * @dev: network device
> + *
> + * Generate traffic such that interested network peers are aware of
> + * @dev, such as by generating a gratuitous ARP. This may be used when
> + * a device wants to inform the rest of the network about some sort of
> + * reconfiguration such as a failover event or virtual machine
> + * migration.
> + */
> +void netdev_notify_peers_locked(struct net_device *dev)

I think __netdev_notify_peers() would be a more typical name for
a core kernel function like this.

> +{
> +	ASSERT_RTNL();
> +	call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev);
> +	call_netdevice_notifiers(NETDEV_RESEND_IGMP, dev);
> +}
> +EXPORT_SYMBOL(netdev_notify_peers_locked);

Otherwise LGTM, seems like a good cleanup.

Powered by blists - more mailing lists