[net] batadv: fix for leaked TVLV handler.

Message ID 20190521195857.14639-1-jeremy@azazel.net (mailing list archive)
State Superseded, archived
Commit 87445d81c360a5f9833546114e98ffd2c1fd3a4d
Delegated to: Simon Wunderlich
Headers
Series [net] batadv: fix for leaked TVLV handler. |

Commit Message

Jeremy Sowden May 21, 2019, 7:58 p.m. UTC
  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.

Reported-by: syzbot+d454a826e670502484b8@syzkaller.appspotmail.com
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 net/batman-adv/translation-table.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Sven Eckelmann May 21, 2019, 8:48 p.m. UTC | #1
On Tuesday, 21 May 2019 21:58:57 CEST Jeremy Sowden wrote:
> 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.
> 
> Reported-by: syzbot+d454a826e670502484b8@syzkaller.appspotmail.com
> Signed-off-by: Jeremy Sowden <jeremy@azazel.net>

Fixes: 122edaa05940 ("batman-adv: tvlv - convert roaming adv packet to use tvlv unicast packets")

@Marek, @Antonio, please check whether this looks good to you.

Kind regards,
	Sven
  
Sven Eckelmann May 24, 2019, 7:56 a.m. UTC | #2
On Tuesday, 21 May 2019 22:48:32 CEST Sven Eckelmann wrote:
> Fixes: 122edaa05940 ("batman-adv: tvlv - convert roaming adv packet to use tvlv unicast packets")

This patch was queued up [1] for submission but it is the only queued patch at 
the moment. And I already saw that David marked this patch as "Under review" 
in patchwork [2]. May I ask whether this means that you (David) would directly 
apply it (unless there are objections)? If so then we could save ourselves an 
extra PR for just this patch. Just depends on what you (David) prefers.

Reviewed-by: Sven Eckelmann <sven@narfation.org>

The only adjustments I personally would like to see when it is applied:

* the Fixes: line
* prefix "batman-adv:" (at least this still seems the one which is usually 
  used for net/batman-adv/ related code)
  But this isn't really a hard  requirement and I also use the shorter 
  "batadv" all the time in other contexts

Kind regards,
	Sven

[1] https://git.open-mesh.org/linux-merge.git/commit/17f78dd1bd624a4dd78ed5db3284a63ee807fcc3
[2] https://patchwork.ozlabs.org/patch/1102982/
  

Patch

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 1ddfd5e011ee..8a482c5ec67b 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -3813,6 +3813,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);