From: Marek Lindner Date: Wed, 23 Apr 2014 19:44:25 +0000 (+0800) Subject: batman-adv: fix indirect hard_iface NULL dereference X-Git-Tag: v3.14.5~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6bc7a13cab3966f03d3efd79892c8d2f085b919;p=thirdparty%2Fkernel%2Fstable.git 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 Signed-off-by: Marek Lindner Acked-by: Antonio Quartulli Signed-off-by: Antonio Quartulli Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 3e6dd914892ae..abf612d7d0aed 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c @@ -1074,7 +1074,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; }