提交 dec05074 编写于 作者: A Antonio Quartulli

batman-adv: Initialize lockdep class keys for hashes

Different hashes have the same class key because they get
initialised with the same one. For this reason lockdep can create
false warning when they are used recursively.

Re-initialise the key for each hash after the invocation to hash_new()
to avoid this problem.
Signed-off-by: NAntonio Quartulli <ordex@autistici.org>
Tested-by: NLinus Lüssing <linus.luessing@web.de>
Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
上级 8425ec6a
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#include "soft-interface.h" #include "soft-interface.h"
#include "bridge_loop_avoidance.h" #include "bridge_loop_avoidance.h"
/* hash class keys */
static struct lock_class_key batadv_orig_hash_lock_class_key;
static void batadv_purge_orig(struct work_struct *work); static void batadv_purge_orig(struct work_struct *work);
static void batadv_start_purge_timer(struct batadv_priv *bat_priv) static void batadv_start_purge_timer(struct batadv_priv *bat_priv)
...@@ -57,6 +60,9 @@ int batadv_originator_init(struct batadv_priv *bat_priv) ...@@ -57,6 +60,9 @@ int batadv_originator_init(struct batadv_priv *bat_priv)
if (!bat_priv->orig_hash) if (!bat_priv->orig_hash)
goto err; goto err;
batadv_hash_set_lock_class(bat_priv->orig_hash,
&batadv_orig_hash_lock_class_key);
batadv_start_purge_timer(bat_priv); batadv_start_purge_timer(bat_priv);
return 0; return 0;
......
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include <linux/crc16.h> #include <linux/crc16.h>
/* hash class keys */
static struct lock_class_key batadv_tt_local_hash_lock_class_key;
static struct lock_class_key batadv_tt_global_hash_lock_class_key;
static void batadv_send_roam_adv(struct batadv_priv *bat_priv, uint8_t *client, static void batadv_send_roam_adv(struct batadv_priv *bat_priv, uint8_t *client,
struct batadv_orig_node *orig_node); struct batadv_orig_node *orig_node);
static void batadv_tt_purge(struct work_struct *work); static void batadv_tt_purge(struct work_struct *work);
...@@ -235,6 +239,9 @@ static int batadv_tt_local_init(struct batadv_priv *bat_priv) ...@@ -235,6 +239,9 @@ static int batadv_tt_local_init(struct batadv_priv *bat_priv)
if (!bat_priv->tt.local_hash) if (!bat_priv->tt.local_hash)
return -ENOMEM; return -ENOMEM;
batadv_hash_set_lock_class(bat_priv->tt.local_hash,
&batadv_tt_local_hash_lock_class_key);
return 0; return 0;
} }
...@@ -694,6 +701,9 @@ static int batadv_tt_global_init(struct batadv_priv *bat_priv) ...@@ -694,6 +701,9 @@ static int batadv_tt_global_init(struct batadv_priv *bat_priv)
if (!bat_priv->tt.global_hash) if (!bat_priv->tt.global_hash)
return -ENOMEM; return -ENOMEM;
batadv_hash_set_lock_class(bat_priv->tt.global_hash,
&batadv_tt_global_hash_lock_class_key);
return 0; return 0;
} }
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#define BATADV_MAX_VIS_PACKET_SIZE 1000 #define BATADV_MAX_VIS_PACKET_SIZE 1000
/* hash class keys */
static struct lock_class_key batadv_vis_hash_lock_class_key;
static void batadv_start_vis_timer(struct batadv_priv *bat_priv); static void batadv_start_vis_timer(struct batadv_priv *bat_priv);
/* free the info */ /* free the info */
...@@ -852,6 +855,9 @@ int batadv_vis_init(struct batadv_priv *bat_priv) ...@@ -852,6 +855,9 @@ int batadv_vis_init(struct batadv_priv *bat_priv)
goto err; goto err;
} }
batadv_hash_set_lock_class(bat_priv->vis.hash,
&batadv_vis_hash_lock_class_key);
bat_priv->vis.my_info = kmalloc(BATADV_MAX_VIS_PACKET_SIZE, GFP_ATOMIC); bat_priv->vis.my_info = kmalloc(BATADV_MAX_VIS_PACKET_SIZE, GFP_ATOMIC);
if (!bat_priv->vis.my_info) if (!bat_priv->vis.my_info)
goto err; goto err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册