Skip to content
Commit fd7dec25 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by David S. Miller
Browse files

batman-adv: Fix memory leak on tt add with invalid vlan

The object tt_local is allocated with kmalloc and not initialized when the
function batadv_tt_local_add checks for the vlan. But this function can
only cleanup the object when the (not yet initialized) reference counter of
the object is 1. This is unlikely and thus the object would leak when the
vlan could not be found.

Instead the uninitialized object tt_local has to be freed manually and the
pointer has to set to NULL to avoid calling the function which would try to
decrement the reference counter of the not existing object.

CID: 1316518
Fixes: 354136bc

 ("batman-adv: fix kernel crash due to missing NULL checks")
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ff94c742
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment