Skip to content

Commit 8de2640

Browse files
committed
ipmi:msghandler: Use READ_ONCE on run_to_completion
It needs to be read only once because it's used in lock/unlock scenarios. Signed-off-by: Corey Minyard <cminyard@mvista.com>
1 parent 9cba938 commit 8de2640

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,13 +1882,12 @@ static void smi_send(struct ipmi_smi *intf,
18821882
const struct ipmi_smi_handlers *handlers,
18831883
struct ipmi_smi_msg *smi_msg, int priority)
18841884
{
1885-
int run_to_completion = intf->run_to_completion;
1885+
int run_to_completion = READ_ONCE(intf->run_to_completion);
18861886
unsigned long flags = 0;
18871887

18881888
if (!run_to_completion)
18891889
spin_lock_irqsave(&intf->xmit_msgs_lock, flags);
18901890
smi_msg = smi_add_send_msg(intf, smi_msg, priority);
1891-
18921891
if (!run_to_completion)
18931892
spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags);
18941893

@@ -4753,10 +4752,10 @@ static int handle_one_recv_msg(struct ipmi_smi *intf,
47534752
*/
47544753
static void handle_new_recv_msgs(struct ipmi_smi *intf)
47554754
{
4756-
struct ipmi_smi_msg *smi_msg;
4757-
unsigned long flags = 0;
4758-
int rv;
4759-
int run_to_completion = intf->run_to_completion;
4755+
struct ipmi_smi_msg *smi_msg;
4756+
unsigned long flags = 0;
4757+
int rv;
4758+
int run_to_completion = READ_ONCE(intf->run_to_completion);
47604759

47614760
/* See if any waiting messages need to be processed. */
47624761
if (!run_to_completion)
@@ -4813,7 +4812,7 @@ static void smi_recv_work(struct work_struct *t)
48134812
{
48144813
unsigned long flags = 0; /* keep us warning-free. */
48154814
struct ipmi_smi *intf = from_work(intf, t, recv_work);
4816-
int run_to_completion = intf->run_to_completion;
4815+
int run_to_completion = READ_ONCE(intf->run_to_completion);
48174816
struct ipmi_smi_msg *newmsg = NULL;
48184817

48194818
/*
@@ -4843,9 +4842,9 @@ static void smi_recv_work(struct work_struct *t)
48434842
intf->curr_msg = newmsg;
48444843
}
48454844
}
4846-
48474845
if (!run_to_completion)
48484846
spin_unlock_irqrestore(&intf->xmit_msgs_lock, flags);
4847+
48494848
if (newmsg)
48504849
intf->handlers->sender(intf->send_info, newmsg);
48514850

@@ -4859,7 +4858,7 @@ void ipmi_smi_msg_received(struct ipmi_smi *intf,
48594858
struct ipmi_smi_msg *msg)
48604859
{
48614860
unsigned long flags = 0; /* keep us warning-free. */
4862-
int run_to_completion = intf->run_to_completion;
4861+
int run_to_completion = READ_ONCE(intf->run_to_completion);
48634862

48644863
/*
48654864
* To preserve message order, we keep a queue and deliver from

0 commit comments

Comments
 (0)