batman-adv: add sanity check when removing global tts

Message ID 20111019082826.GA31323@pandem0nium (mailing list archive)
State Accepted, archived
Commit 24ccf55154d49d78660a28f383664e938f9e97f2
Headers

Commit Message

Simon Wunderlich Oct. 19, 2011, 8:28 a.m. UTC
  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 <siwu@hrz.tu-chemnitz.de>
---
 translation-table.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
  

Comments

Antonio Quartulli Oct. 23, 2011, 9:38 a.m. UTC | #1
Hello,

On Wed, Oct 19, 2011 at 10:28:26AM +0200, Simon Wunderlich wrote:
> 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 <siwu@hrz.tu-chemnitz.de>
> ---

I got a feedback on IRC from fishor_ who said that the patch solved the kernel
panic problem on module unload and on soft_iface deactivating.

Thank you for the patch Simon!
  
Alexey Fisher Oct. 23, 2011, 9:42 a.m. UTC | #2
On 23.10.2011 11:38, Antonio Quartulli wrote:
> Hello,
> 
> On Wed, Oct 19, 2011 at 10:28:26AM +0200, Simon Wunderlich wrote:
>> 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 <siwu@hrz.tu-chemnitz.de>
>> ---
> 
> I got a feedback on IRC from fishor_ who said that the patch solved the kernel
> panic problem on module unload and on soft_iface deactivating.
> 
> Thank you for the patch Simon!
> 

tested-by: Alexey Fisher <bug-track@fisher-privat.net>
  
Marek Lindner Oct. 24, 2011, 12:07 p.m. UTC | #3
On Sunday, October 23, 2011 11:42:25 Alexey Fisher wrote:
> On 23.10.2011 11:38, Antonio Quartulli wrote:
> > Hello,
> > 
> > On Wed, Oct 19, 2011 at 10:28:26AM +0200, Simon Wunderlich wrote:
> >> 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 <siwu@hrz.tu-chemnitz.de>
> >> ---
> > 
> > I got a feedback on IRC from fishor_ who said that the patch solved the
> > kernel panic problem on module unload and on soft_iface deactivating.
> > 
> > Thank you for the patch Simon!
> 
> tested-by: Alexey Fisher <bug-track@fisher-privat.net>

Patch was applied in revision 4c7d468.

Thanks,
Marek
  

Patch

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];