[B.A.T.M.A.N.] [PATCH 1/4] batman-adv: fix indirect hard_iface NULL dereference

Antonio Quartulli antonio at meshcoding.com
Thu May 15 20:50:49 CEST 2014


From: Marek Lindner <mareklindner at neomailbox.ch>

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 at narfation.org>
Signed-off-by: Marek Lindner <mareklindner at neomailbox.ch>
Acked-by: Antonio Quartulli <antonio at meshcoding.com>
Signed-off-by: Antonio Quartulli <antonio at meshcoding.com>
---
 net/batman-adv/originator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 1785da3..6a48451 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -1079,7 +1079,8 @@ int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset)
 	bat_priv->bat_algo_ops->bat_orig_print(bat_priv, seq, hard_iface);
 
 out:
-	batadv_hardif_free_ref(hard_iface);
+	if (hard_iface)
+		batadv_hardif_free_ref(hard_iface);
 	return 0;
 }
 
-- 
1.8.5.5



More information about the B.A.T.M.A.N mailing list