On 17/06/15 12:42, Marek Lindner wrote: > batadv_softif_vlan_get() may return NULL which has to be verified > by the caller. > > Reported-by: Ryan Thompson <[email protected]> > Signed-off-by: Marek Lindner <[email protected]>
one comment is inline:
> ---
> soft-interface.c | 3 +++
> translation-table.c | 17 +++++++++++++----
> 2 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/soft-interface.c b/soft-interface.c
> index da89336..7841a4b 100644
> --- a/soft-interface.c
> +++ b/soft-interface.c
> @@ -455,6 +455,9 @@ out:
> */
> void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan)
> {
> + if (!vlan)
> + return;
> +
> if (atomic_dec_and_test(&vlan->refcount)) {
> spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock);
> hlist_del_rcu(&vlan->list);
> diff --git a/translation-table.c b/translation-table.c
> index e95a424..efbcb59 100644
> --- a/translation-table.c
> +++ b/translation-table.c
> @@ -575,6 +575,8 @@ bool batadv_tt_local_add(struct net_device *soft_iface,
> const uint8_t *addr,
>
> /* increase the refcounter of the related vlan */
> vlan = batadv_softif_vlan_get(bat_priv, vid);
> + if (!vlan)
> + goto out;
In this case I'd use a WARN here because if we are adding a local client
to a specific VLAN the assumption is that batman-adv is already aware of
this VLAN, therefore this condition is not expected to be true.
Cheers,
--
Antonio Quartulli
signature.asc
Description: OpenPGP digital signature
