Skip to content

Commit 2f7c069

Browse files
peterhurleydavem330
authored andcommitted
net/irda: Hold port lock while bumping blocked_open
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>
1 parent a4ed2e7 commit 2f7c069

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/irda/ircomm/ircomm_tty.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
317317
spin_lock_irqsave(&port->lock, flags);
318318
if (!tty_hung_up_p(filp))
319319
port->count--;
320-
spin_unlock_irqrestore(&port->lock, flags);
321320
port->blocked_open++;
321+
spin_unlock_irqrestore(&port->lock, flags);
322322

323323
while (1) {
324324
if (tty->termios.c_cflag & CBAUD)
@@ -362,8 +362,8 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
362362
spin_lock_irqsave(&port->lock, flags);
363363
if (!tty_hung_up_p(filp))
364364
port->count++;
365-
spin_unlock_irqrestore(&port->lock, flags);
366365
port->blocked_open--;
366+
spin_unlock_irqrestore(&port->lock, flags);
367367

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

0 commit comments

Comments
 (0)