]> git.baikalelectronics.ru Git - kernel.git/commit
batman-adv: Fix memory leak on tt add with invalid vlan
authorSven Eckelmann <sven@narfation.org>
Tue, 18 Aug 2015 11:37:01 +0000 (13:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Aug 2015 02:08:23 +0000 (19:08 -0700)
commit80d056a80ac22b9616533ed83d1927c7a721990b
tree2f16bcbb872e72622506b36fe3e32c503bc78b29
parent8af0199490810881316e24aaab131148214914ff
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: 9bec1bdc330e ("batman-adv: fix kernel crash due to missing NULL checks")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/batman-adv/translation-table.c