Skip to contentSkip to conversation

ipmi: missing NULL test for kthread

PATCH In review Matt Domsch 2 participants 2 messages Nov 16, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipmi: missing NULL test for kthread

On IPMI systems with BT interfaces, we don't start the kernel thread, so smi_info->thread is NULL. Test for NULL when stopping the thread, because kthread_stop() doesn't, and an oops ensues otherwise.

Signature · 17 lines
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

diff -urNp --exclude-from=/home/mdomsch/excludes --minimal linux-2.6/drivers/char/ipmi/ipmi_si_intf.c linux-2.6.ipmi/drivers/char/ipmi/ipmi_si_intf.c
--- linux-2.6/drivers/char/ipmi/ipmi_si_intf.c	Wed Nov 16 08:45:57 2005
+++ linux-2.6.ipmi/drivers/char/ipmi/ipmi_si_intf.c	Wed Nov 16 08:49:12 2005
@@ -2203,7 +2203,7 @@ static void setup_xaction_handlers(struc
 
 static inline void wait_for_timer_and_thread(struct smi_info *smi_info)
 {
-	if (smi_info->thread != ERR_PTR(-ENOMEM))
+	if (smi_info->thread != NULL && smi_info->thread != ERR_PTR(-ENOMEM))
 		kthread_stop(smi_info->thread);
 	del_timer_sync(&smi_info->si_timer);
 }
#1 lore raw
Quoted 8 lines · Matt Domsch

On IPMI systems with BT interfaces, we don't start the kernel thread, so smi_info->thread is NULL. Test for NULL when stopping the thread, because kthread_stop() doesn't, and an oops ensues otherwise.

Yes, obvious fix, please apply. I wish I had a system with a BT interface :(. Of course, then I'd have to find a place to put it, and I'd have an unhappy wife...

-Corey