Skip to content

Commit

Permalink
vt: fix vc_resize locking
Browse files Browse the repository at this point in the history
Lockdep says we can't take tasklist lock or sighand lock inside ctrl_lock.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Acked-by: Alan Cox <alan@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Jun 6, 2008
1 parent dfcceb2 commit 81c6ce9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/char/vt.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,19 +909,22 @@ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines)

if (vc->vc_tty) {
struct winsize ws, *cws = &vc->vc_tty->winsize;
unsigned long flags;
struct pid *pgrp = NULL;

memset(&ws, 0, sizeof(ws));
ws.ws_row = vc->vc_rows;
ws.ws_col = vc->vc_cols;
ws.ws_ypixel = vc->vc_scan_lines;

mutex_lock(&vc->vc_tty->termios_mutex);
spin_lock_irqsave(&vc->vc_tty->ctrl_lock, flags);
if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col) &&
vc->vc_tty->pgrp)
spin_lock_irq(&vc->vc_tty->ctrl_lock);
if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col))
pgrp = get_pid(vc->vc_tty->pgrp);
spin_unlock_irq(&vc->vc_tty->ctrl_lock);
if (pgrp) {
kill_pgrp(vc->vc_tty->pgrp, SIGWINCH, 1);
spin_unlock_irqrestore(&vc->vc_tty->ctrl_lock, flags);
put_pid(pgrp);
}
*cws = ws;
mutex_unlock(&vc->vc_tty->termios_mutex);
}
Expand Down

0 comments on commit 81c6ce9

Please sign in to comment.