Skip to content

Commit

Permalink
pciehp: Add missing memory barrier
Browse files Browse the repository at this point in the history
Fix the possible race condition between pcie_isr() and pciehp_write_cmd()
because of the lack of memory barrier.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by:  Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
Kenji Kaneshige authored and Jesse Barnes committed Apr 25, 2008
1 parent c6b069e commit 2d32a9a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/pci/hotplug/pciehp_hpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd, u16 mask)
slot_ctrl |= ((cmd & mask) | CMD_CMPL_INTR_ENABLE);

ctrl->cmd_busy = 1;
smp_mb();
retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl);
if (retval)
err("%s: Cannot write to SLOTCTRL register\n", __func__);
Expand Down Expand Up @@ -759,6 +760,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
/* Check Command Complete Interrupt Pending */
if (intr_loc & CMD_COMPLETED) {
ctrl->cmd_busy = 0;
smp_mb();
wake_up_interruptible(&ctrl->queue);
}

Expand Down

0 comments on commit 2d32a9a

Please sign in to comment.