Commit 7e8158b3 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Greg Kroah-Hartman

Staging: batman-adv: Track references of batman_if in set_primary_if

set_primary_if exchanges the current primary interfaces with a new one.
This is a new reference and thus we have to count it and decrease the
count of the old primary interface.
Signed-off-by: default avatarSven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 399fb5b4
...@@ -111,9 +111,17 @@ static void set_primary_if(struct bat_priv *bat_priv, ...@@ -111,9 +111,17 @@ static void set_primary_if(struct bat_priv *bat_priv,
{ {
struct batman_packet *batman_packet; struct batman_packet *batman_packet;
struct vis_packet *vis_packet; struct vis_packet *vis_packet;
struct batman_if *old_if;
if (batman_if)
hardif_hold(batman_if);
old_if = bat_priv->primary_if;
bat_priv->primary_if = batman_if; bat_priv->primary_if = batman_if;
if (old_if)
hardif_put(old_if);
if (!bat_priv->primary_if) if (!bat_priv->primary_if)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment