public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: free the dat hash only if not NULL
@ 2012-10-29 14:38 Antonio Quartulli
  2012-11-01  4:47 ` Marek Lindner
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2012-10-29 14:38 UTC (permalink / raw)
  To: b.a.t.m.a.n

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 <ordex@autistici.org>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-01  4:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-29 14:38 [B.A.T.M.A.N.] [PATCH] batman-adv: free the dat hash only if not NULL Antonio Quartulli
2012-11-01  4:47 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox