Skip to content

Commit

Permalink
net/irda: Use barrier to set task state
Browse files Browse the repository at this point in the history
Without a memory and compiler barrier, the task state change
can migrate relative to the condition testing in a blocking loop.
However, the task state change must be visible across all cpus
prior to testing those conditions. Failing to do this can result
in the familiar 'lost wakeup' and this task will hang until killed.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Peter Hurley authored and David S. Miller committed Mar 6, 2013
1 parent 2f7c069 commit 0b176ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/irda/ircomm/ircomm_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
if (tty->termios.c_cflag & CBAUD)
tty_port_raise_dtr_rts(port);

current->state = TASK_INTERRUPTIBLE;
set_current_state(TASK_INTERRUPTIBLE);

if (tty_hung_up_p(filp) ||
!test_bit(ASYNCB_INITIALIZED, &port->flags)) {
Expand Down

0 comments on commit 0b176ce

Please sign in to comment.