Skip to content

Commit b7753fc

Browse files
committed
pstore: Make sure console capturing will restart
The CON_ENABLED flag gets cleared during unregister_console(), so make sure we already reset the console flags before calling register_console(), otherwise unloading and reloading a pstore backend will not restart console logging. Signed-off-by: Kees Cook <[email protected]>
1 parent 609e28b commit b7753fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/pstore/platform.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,16 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
516516
static struct console pstore_console = {
517517
.name = "pstore",
518518
.write = pstore_console_write,
519-
.flags = CON_PRINTBUFFER | CON_ENABLED | CON_ANYTIME,
520519
.index = -1,
521520
};
522521

523522
static void pstore_register_console(void)
524523
{
524+
/*
525+
* Always initialize flags here since prior unregister_console()
526+
* calls may have changed settings (specifically CON_ENABLED).
527+
*/
528+
pstore_console.flags = CON_PRINTBUFFER | CON_ENABLED | CON_ANYTIME;
525529
register_console(&pstore_console);
526530
}
527531

0 commit comments

Comments
 (0)