Skip to content

Commit

Permalink
net/irda: Hold port lock while bumping blocked_open
Browse files Browse the repository at this point in the history
Although tty_lock() already protects concurrent update to
blocked_open, that fails to meet the separation-of-concerns between
tty_port and tty.

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 a4ed2e7 commit 2f7c069
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/irda/ircomm/ircomm_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
spin_lock_irqsave(&port->lock, flags);
if (!tty_hung_up_p(filp))
port->count--;
spin_unlock_irqrestore(&port->lock, flags);
port->blocked_open++;
spin_unlock_irqrestore(&port->lock, flags);

while (1) {
if (tty->termios.c_cflag & CBAUD)
Expand Down Expand Up @@ -362,8 +362,8 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
spin_lock_irqsave(&port->lock, flags);
if (!tty_hung_up_p(filp))
port->count++;
spin_unlock_irqrestore(&port->lock, flags);
port->blocked_open--;
spin_unlock_irqrestore(&port->lock, flags);

IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n",
__FILE__, __LINE__, tty->driver->name, port->count);
Expand Down

0 comments on commit 2f7c069

Please sign in to comment.