pstore: Remove needless lock during console writes

Since the console writer does not use the preallocated crash dump buffer
any more, there is no reason to perform locking around it.

Fixes: 70ad35db33 ("pstore: Convert console write to use ->write_buf")
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
This commit is contained in:
Kees Cook 2018-11-01 14:08:07 -07:00
parent bdabc8e71c
commit b77fa617a2
1 changed files with 6 additions and 23 deletions

View File

@ -462,31 +462,14 @@ static void pstore_unregister_kmsg(void)
#ifdef CONFIG_PSTORE_CONSOLE #ifdef CONFIG_PSTORE_CONSOLE
static void pstore_console_write(struct console *con, const char *s, unsigned c) static void pstore_console_write(struct console *con, const char *s, unsigned c)
{ {
const char *e = s + c; struct pstore_record record;
while (s < e) { pstore_record_init(&record, psinfo);
struct pstore_record record; record.type = PSTORE_TYPE_CONSOLE;
unsigned long flags;
pstore_record_init(&record, psinfo); record.buf = (char *)s;
record.type = PSTORE_TYPE_CONSOLE; record.size = c;
psinfo->write(&record);
if (c > psinfo->bufsize)
c = psinfo->bufsize;
if (oops_in_progress) {
if (!spin_trylock_irqsave(&psinfo->buf_lock, flags))
break;
} else {
spin_lock_irqsave(&psinfo->buf_lock, flags);
}
record.buf = (char *)s;
record.size = c;
psinfo->write(&record);
spin_unlock_irqrestore(&psinfo->buf_lock, flags);
s += c;
c = e - s;
}
} }
static struct console pstore_console = { static struct console pstore_console = {