mirror of
https://github.com/torvalds/linux.git
synced 2026-09-29 12:24:02 +02:00
batman-adv: make hard_iface->mesh_iface immutable
With the hard_iface now being created for a specific mesh_iface, it is beneficial not to set mesh_iface to NULL when the interface is disabled, but instead keeping it immutable after the initial setup of the hard_iface. By also holding the reference to the mesh_iface until the hard_iface is released, hard_ifaces iterated over under RCU will always point to a valid mesh_iface. Co-developed-by: Nora Schiffer <neocturne@universe-factory.net> Signed-off-by: Nora Schiffer <neocturne@universe-factory.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
parent
49e9de6e12
commit
f846e77953
|
|
@ -63,6 +63,7 @@ void batadv_hardif_release(struct kref *ref)
|
|||
struct batadv_hard_iface *hard_iface;
|
||||
|
||||
hard_iface = container_of(ref, struct batadv_hard_iface, refcount);
|
||||
netdev_put(hard_iface->mesh_iface, &hard_iface->meshif_dev_tracker);
|
||||
netdev_put(hard_iface->net_dev, &hard_iface->dev_tracker);
|
||||
|
||||
kfree_rcu(hard_iface, rcu);
|
||||
|
|
@ -829,8 +830,6 @@ int batadv_hardif_enable_interface(struct net_device *net_dev,
|
|||
err_upper:
|
||||
netdev_upper_dev_unlink(hard_iface->net_dev, mesh_iface);
|
||||
err_dev:
|
||||
hard_iface->mesh_iface = NULL;
|
||||
netdev_put(mesh_iface, &hard_iface->meshif_dev_tracker);
|
||||
batadv_hardif_put(hard_iface);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -871,7 +870,6 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
|
|||
/* delete all references to this hard_iface */
|
||||
batadv_purge_orig_ref(bat_priv);
|
||||
batadv_purge_outstanding_packets(bat_priv, hard_iface);
|
||||
netdev_put(hard_iface->mesh_iface, &hard_iface->meshif_dev_tracker);
|
||||
|
||||
batadv_hardif_generation++;
|
||||
netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->mesh_iface);
|
||||
|
|
@ -881,7 +879,6 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
|
|||
if (list_empty(&hard_iface->mesh_iface->adj_list.lower))
|
||||
batadv_gw_check_client_stop(bat_priv);
|
||||
|
||||
hard_iface->mesh_iface = NULL;
|
||||
batadv_hardif_put(hard_iface);
|
||||
|
||||
out:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user