It could be the case that the user tries to disable DAT when it is already
disabled. To prevent kernel oops, batadv_dat_hash_free() has to check for the
hash table pointer being different from NULL before to try to free it.

This was introduced by ("batman-adv: Distributed ARP Table - add runtime
switch")

Signed-off-by: Antonio Quartulli <[email protected]>
---
 distributed-arp-table.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/distributed-arp-table.c b/distributed-arp-table.c
index c933615..0fea29a 100644
--- a/distributed-arp-table.c
+++ b/distributed-arp-table.c
@@ -634,6 +634,9 @@ out:
  */
 static void batadv_dat_hash_free(struct batadv_priv *bat_priv)
 {
+       if (!bat_priv->dat.hash)
+               return;
+
        __batadv_dat_purge(bat_priv, NULL);
 
        batadv_hash_destroy(bat_priv->dat.hash);
-- 
1.7.12.4

Reply via email to