From patchwork Sat Nov 10 10:00:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2465 Return-Path: Received: from contumacia.investici.org (contumacia.investici.org [178.255.144.35]) by open-mesh.org (Postfix) with ESMTPS id B95B36002B2 for ; Sat, 10 Nov 2012 11:01:24 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass reason="1024-bit key; insecure key" header.d=autistici.org header.i=@autistici.org header.b=hzz8sZ4q; dkim-adsp=pass; dkim-atps=neutral Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id AD21FE884F; Sat, 10 Nov 2012 10:01:23 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org AD21FE884F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1352541684; bh=cWR6alGsV3ZfO00hb8jwbzB93JzC2valY8ftSfqeQz4=; h=From:To:Cc:Subject:Date:Message-Id; b=hzz8sZ4q8ayldTYnzGGBBsRiloUp03giYCU3tNAQhC66yYsppSBiLUrondRz85T0E CQJcSlMtl4zAJ1pm61/Rfs37OBkzpa5uwMZyp3I7rV+O6I32ZVBvHXREYdu4oqPsW4 MaQa6IJaEOrY1AtxjWr/yogHavT7m1ic/a5/9e5c= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 10 Nov 2012 11:00:32 +0100 Message-Id: <1352541632-25336-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.8.0 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Initialize lockdep class keys for hashes X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Nov 2012 10:01:25 -0000 Different hashes have the same class key 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: Antonio Quartulli Tested-by: Linus Lüssing --- originator.c | 6 ++++++ translation-table.c | 10 ++++++++++ vis.c | 6 ++++++ 3 files changed, 22 insertions(+) diff --git a/originator.c b/originator.c index 8c32cf1..109081c 100644 --- a/originator.c +++ b/originator.c @@ -29,6 +29,9 @@ #include "soft-interface.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_start_purge_timer(struct batadv_priv *bat_priv) @@ -57,6 +60,9 @@ int batadv_originator_init(struct batadv_priv *bat_priv) if (!bat_priv->orig_hash) goto err; + batadv_hash_set_lock_class(bat_priv->orig_hash, + &batadv_orig_hash_lock_class_key); + batadv_start_purge_timer(bat_priv); return 0; diff --git a/translation-table.c b/translation-table.c index 4657d9e..1bcb705 100644 --- a/translation-table.c +++ b/translation-table.c @@ -29,6 +29,10 @@ #include +/* 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, struct batadv_orig_node *orig_node); static void batadv_tt_purge(struct work_struct *work); @@ -235,6 +239,9 @@ static int batadv_tt_local_init(struct batadv_priv *bat_priv) if (!bat_priv->tt.local_hash) return -ENOMEM; + batadv_hash_set_lock_class(bat_priv->tt.local_hash, + &batadv_tt_local_hash_lock_class_key); + return 0; } @@ -691,6 +698,9 @@ static int batadv_tt_global_init(struct batadv_priv *bat_priv) if (!bat_priv->tt.global_hash) return -ENOMEM; + batadv_hash_set_lock_class(bat_priv->tt.global_hash, + &batadv_tt_global_hash_lock_class_key); + return 0; } diff --git a/vis.c b/vis.c index 0f65a9d..60eb9b7 100644 --- a/vis.c +++ b/vis.c @@ -28,6 +28,9 @@ #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); /* free the info */ @@ -852,6 +855,9 @@ int batadv_vis_init(struct batadv_priv *bat_priv) 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); if (!bat_priv->vis.my_info) goto err;