net/irda: Use barrier to set task state
authorPeter Hurley <peter@hurleysoftware.com>
Tue, 5 Mar 2013 06:09:06 +0000 (06:09 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Mar 2013 07:47:04 +0000 (02:47 -0500)
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>
net/irda/ircomm/ircomm_tty.c

index d282bbea710e0b04d72c7b1d4b6d07d7fa041657..522543d9264ac7c6ecf797b3a17f65c55de03a7a 100644 (file)
@@ -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)) {