[PATCH] dquot: add proper locking when using current->signal->tty
Dquot passes the tty to tty_write_message without locking Signed-off-by: Jan Kara <jack@suse.cz> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
254e948b29
commit
b525a7e444
1 changed files with 5 additions and 0 deletions
|
@ -834,6 +834,9 @@ static void print_warning(struct dquot *dquot, const char warntype)
|
||||||
if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
|
if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mutex_lock(&tty_mutex);
|
||||||
|
if (!current->signal->tty)
|
||||||
|
goto out_lock;
|
||||||
tty_write_message(current->signal->tty, dquot->dq_sb->s_id);
|
tty_write_message(current->signal->tty, dquot->dq_sb->s_id);
|
||||||
if (warntype == ISOFTWARN || warntype == BSOFTWARN)
|
if (warntype == ISOFTWARN || warntype == BSOFTWARN)
|
||||||
tty_write_message(current->signal->tty, ": warning, ");
|
tty_write_message(current->signal->tty, ": warning, ");
|
||||||
|
@ -861,6 +864,8 @@ static void print_warning(struct dquot *dquot, const char warntype)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tty_write_message(current->signal->tty, msg);
|
tty_write_message(current->signal->tty, msg);
|
||||||
|
out_lock:
|
||||||
|
mutex_unlock(&tty_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void flush_warnings(struct dquot **dquots, char *warntype)
|
static inline void flush_warnings(struct dquot **dquots, char *warntype)
|
||||||
|
|
Loading…
Reference in a new issue