batman-adv: fix for leaked TVLV handler. [Linux 4.4.187]

This Linux kernel change "batman-adv: fix for leaked TVLV handler" is included in the Linux 4.4.187 release. This change is authored by Jeremy Sowden <jeremy [at] azazel.net> on Tue May 21 20:58:57 2019 +0100. The commit for this change in Linux stable tree is 11648a3 (patch) which is from upstream commit 17f78dd. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 17f78dd.

batman-adv: fix for leaked TVLV handler.

[ Upstream commit 17f78dd1bd624a4dd78ed5db3284a63ee807fcc3 ]

A handler for BATADV_TVLV_ROAM was being registered when the
translation-table was initialized, but not unregistered when the
translation-table was freed.  Unregister it.

Fixes: 122edaa05940 ("batman-adv: tvlv - convert roaming adv packet to use tvlv unicast packets")
Reported-by: syzbot+d454a826e670502484b8@syzkaller.appspotmail.com
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/batman-adv/translation-table.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index f2079ac..ffd49b4 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -3158,6 +3158,8 @@ static void batadv_tt_purge(struct work_struct *work)

 void batadv_tt_free(struct batadv_priv *bat_priv)
 {
+   batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_ROAM, 1);
+
    batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1);
    batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1);

Leave a Reply

Your email address will not be published. Required fields are marked *