提交 3f744430 编写于 作者: K Kees Cook 提交者: Xie XiuQi

pstore: Remove needless lock during console writes

mainline inclusion
from mainline-5.0
commit b77fa617a2ff
category: bugfix
bugzilla: 5889
CVE: NA

-------------------------------------------------

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

Fixes: 70ad35db ("pstore: Convert console write to use ->write_buf")
Signed-off-by: NKees Cook <keescook@chromium.org>
Reviewed-by: NJoel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: NHou Tao <houtao1@huawei.com>
Reviewed-by: NYufen Yu <yuyufen@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 78bb6e41
...@@ -476,31 +476,14 @@ static void pstore_unregister_kmsg(void) ...@@ -476,31 +476,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.type = PSTORE_TYPE_CONSOLE;
if (c > psinfo->bufsize)
c = psinfo->bufsize;
if (oops_in_progress) { record.buf = (char *)s;
if (!spin_trylock_irqsave(&psinfo->buf_lock, flags)) record.size = c;
break; psinfo->write(&record);
} 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 = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册