batman-adv: fix potential orig_node reference leak
authorSimon Wunderlich <sw@simonwunderlich.de>
Sat, 8 Feb 2014 15:45:06 +0000 (16:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2014 06:06:16 +0000 (22:06 -0800)
commit456252dff8921cbd59a6ccd88016d49130d974ba
tree38669a571234e4f62277f94784fff7b1068cb797
parent45756c3dfa56ecc4a1f813d1051d9944f538153d
batman-adv: fix potential orig_node reference leak

[ Upstream commit b2262df7fcf2c395eca564df83238e931d88d7bf ]

Since batadv_orig_node_new() sets the refcount to two, assuming that
the calling function will use a reference for putting the orig_node into
a hash or similar, both references must be freed if initialization of
the orig_node fails. Otherwise that object may be leaked in that error
case.

Reported-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/batman-adv/bat_iv_ogm.c