diff mbox

[3/9] batman-adv: Increase hard_iface refcnt for ptype

Message ID 1457190564-11419-3-git-send-email-sven@narfation.org
State Accepted, archived
Commit feffc04d3ddcd737eb92d9eb9bda086b9887f434
Delegated to: Marek Lindner
Headers show

Commit Message

Sven Eckelmann March 5, 2016, 3:09 p.m. UTC
The hard_iface is referenced in the packet_type for batman-adv. Increase
the refcounter of the hard_interface for it to have an explicit reference
for it in case this functionality gets refactorted and the currently
used implicit reference for it will be removed.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/hard-interface.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Marek Lindner March 31, 2016, 8:58 a.m. UTC | #1
On Saturday, March 05, 2016 16:09:18 Sven Eckelmann wrote:
> The hard_iface is referenced in the packet_type for batman-adv. Increase
> the refcounter of the hard_interface for it to have an explicit reference
> for it in case this functionality gets refactorted and the currently
> used implicit reference for it will be removed.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  net/batman-adv/hard-interface.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied in revision feffc04.

Thanks,
Marek
diff mbox

Patch

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 3240a67..56b148a 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -519,6 +519,7 @@  int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 		goto err_upper;
 	}
 
+	kref_get(&hard_iface->refcount);
 	hard_iface->batman_adv_ptype.type = ethertype;
 	hard_iface->batman_adv_ptype.func = batadv_batman_skb_recv;
 	hard_iface->batman_adv_ptype.dev = hard_iface->net_dev;
@@ -581,6 +582,7 @@  void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
 	batadv_info(hard_iface->soft_iface, "Removing interface: %s\n",
 		    hard_iface->net_dev->name);
 	dev_remove_pack(&hard_iface->batman_adv_ptype);
+	batadv_hardif_put(hard_iface);
 
 	bat_priv->num_ifaces--;
 	batadv_orig_hash_del_if(hard_iface, bat_priv->num_ifaces);