2005-09-22 13:25:23

by Hironobu Ishii

[permalink] [raw]
Subject: [PATCH] ipmi_msghandler: inconsistent spin_lock usage

Hi Corey,

I found a inconsistent spin_lock usage in ipmi_smi_msg_received.

Best regards,
Hironobu Ishii

Signed-off-by: Hironobu Ishii <[email protected]>
------
diff -urNp linux-2.6.14-rc1.org/drivers/char/ipmi/ipmi_msghandler.c linux-2.6.14-rc1/drivers/char/ipmi/ipmi_msghandler.c
--- linux-2.6.14-rc1.org/drivers/char/ipmi/ipmi_msghandler.c 2005-09-13 12:12:09.000000000 +0900
+++ linux-2.6.14-rc1/drivers/char/ipmi/ipmi_msghandler.c 2005-09-22 16:37:48.623052375 +0900
@@ -2620,7 +2620,7 @@ void ipmi_smi_msg_received(ipmi_smi_t
spin_lock_irqsave(&(intf->waiting_msgs_lock), flags);
if (!list_empty(&(intf->waiting_msgs))) {
list_add_tail(&(msg->link), &(intf->waiting_msgs));
- spin_unlock(&(intf->waiting_msgs_lock));
+ spin_unlock_irqrestore(&(intf->waiting_msgs_lock), flags);
goto out_unlock;
}
spin_unlock_irqrestore(&(intf->waiting_msgs_lock), flags);
@@ -2629,9 +2629,9 @@ void ipmi_smi_msg_received(ipmi_smi_t
if (rv > 0) {
/* Could not handle the message now, just add it to a
list to handle later. */
- spin_lock(&(intf->waiting_msgs_lock));
+ spin_lock_irqsave(&(intf->waiting_msgs_lock), flags);
list_add_tail(&(msg->link), &(intf->waiting_msgs));
- spin_unlock(&(intf->waiting_msgs_lock));
+ spin_unlock_irqrestore(&(intf->waiting_msgs_lock), flags);
} else if (rv == 0) {
ipmi_free_smi_msg(msg);
}