Skip to content

Commit

Permalink
Staging: batman-adv: Track references of batman_if in set_primary_if
Browse files Browse the repository at this point in the history
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: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Sven Eckelmann authored and Greg Kroah-Hartman committed Sep 20, 2010
1 parent 399fb5b commit 7e8158b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/staging/batman-adv/hard-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ static void set_primary_if(struct bat_priv *bat_priv,
{
struct batman_packet *batman_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;

if (old_if)
hardif_put(old_if);

if (!bat_priv->primary_if)
return;

Expand Down

0 comments on commit 7e8158b

Please sign in to comment.