From patchwork Wed Oct 19 08:28:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 1281 Return-Path: Received: from cora.hrz.tu-chemnitz.de (cora.hrz.tu-chemnitz.de [134.109.228.40]) by open-mesh.org (Postfix) with ESMTPS id B5EE4600848 for ; Wed, 19 Oct 2011 10:28:28 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@tu-chemnitz.de; dkim-adsp=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tu-chemnitz.de; s=dkim2010; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date; bh=43UuytQ2srRUWGsRetjr4CYxCPV0R+BGjL4qaeulf3w=; b=IGFPXakZcy9nm9ISuKZj3NQ76hUxo3I+BFr2gfO5Obc+ur3qJ0y/wu/yJjUyc0YahLdxv2Ql4zZerq5Axwm93qNbTJPpPXDdZ+TldXWVmrcysAMc794HEnm7wosOww1Q763u9tKI6BYhAyqYcu4OteYWjlkTh5ydYIgCApKDD08=; Received: from p57aa10f6.dip0.t-ipconnect.de ([87.170.16.246] helo=pandem0nium) by cora.hrz.tu-chemnitz.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1RGRVj-00052g-QN for b.a.t.m.a.n@lists.open-mesh.org; Wed, 19 Oct 2011 10:28:28 +0200 Received: from dotslash by pandem0nium with local (Exim 4.72) (envelope-from ) id 1RGRVi-0008AI-Hb for b.a.t.m.a.n@lists.open-mesh.org; Wed, 19 Oct 2011 10:28:26 +0200 Date: Wed, 19 Oct 2011 10:28:26 +0200 From: Simon Wunderlich To: b.a.t.m.a.n@lists.open-mesh.org Message-ID: <20111019082826.GA31323@pandem0nium> MIME-Version: 1.0 Content-Disposition: inline Precedence: first-class Priority: normal User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam-Score: -1.0 (-) X-Spam-Report: --- Textanalyse SpamAssassin 3.3.1 (-1.0 Punkte) Fragen an/questions to: Postmaster TU Chemnitz * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP --- Ende Textanalyse X-Scan-Signature: 9d07cb7fdf33a498459ed645a19e7d68 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: add sanity check when removing global tts X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 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: Wed, 19 Oct 2011 08:28:29 -0000 After removing the batman-adv module, the hash may be already gone when tt_global_del_orig() tries to clean the hash. This patch adds a sanity check to avoid this. Signed-off-by: Simon Wunderlich tested-by: Alexey Fisher --- translation-table.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/translation-table.c b/translation-table.c index c2af2b1..ffa846c 100644 --- a/translation-table.c +++ b/translation-table.c @@ -712,6 +712,9 @@ void tt_global_del_orig(struct bat_priv *bat_priv, struct hlist_head *head; spinlock_t *list_lock; /* protects write access to the hash lists */ + if (!hash) + return; + for (i = 0; i < hash->size; i++) { head = &hash->table[i]; list_lock = &hash->list_locks[i];