[maint] batman-adv: fix indirect hard_iface NULL dereference
Commit Message
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.
Reported-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
originator.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On 23/04/14 21:46, Marek Lindner wrote:
> 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.
>
> Reported-by: Sven Eckelmann <sven@narfation.org>
> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
ACK for the change, but shouldn't we have an Introduced-by in each
patch? Later I will change it to point to the "proper" patch before
sending these changes to David.
Cheers,
On Thursday 24 April 2014 14:03:29 Antonio Quartulli wrote:
> On 23/04/14 21:46, Marek Lindner wrote:
> > 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.
> >
> > Reported-by: Sven Eckelmann <sven@narfation.org>
> > Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
>
> ACK for the change, but shouldn't we have an Introduced-by in each
> patch? Later I will change it to point to the "proper" patch before
> sending these changes to David.
Applied in revision 2ac2c94 (with Introduced-by).
Regards,
Marek
@@ -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;
}