Commit b6bc7a13cab3966f03d3efd79892c8d2f085b919

Authored by Marek Lindner
Committed by Greg Kroah-Hartman
1 parent d83924d768

batman-adv: fix indirect hard_iface NULL dereference

[ Upstream commit 16a4142363b11952d3aa76ac78004502c0c2fe6e ]

If hard_iface is NULL and goto out is made batadv_hardif_free_ref()
doesn't check for NULL before dereferencing it to get to refcount.

Introduced in cb1c92ec37fb70543d133a1fa7d9b54d6f8a1ecd
("batman-adv: add debugfs support to view multiif tables").

Reported-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Acked-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

net/batman-adv/originator.c
... ... @@ -1074,7 +1074,8 @@
1074 1074 bat_priv->bat_algo_ops->bat_orig_print(bat_priv, seq, hard_iface);
1075 1075  
1076 1076 out:
1077   - batadv_hardif_free_ref(hard_iface);
  1077 + if (hard_iface)
  1078 + batadv_hardif_free_ref(hard_iface);
1078 1079 return 0;
1079 1080 }
1080 1081