Skip to content

Commit

Permalink
console: Don't notify user space when unregister non-listed console
Browse files Browse the repository at this point in the history
If console is not on the list then there is nothing for us to do
and sysfs notify is pointless.

Note, that nr_ext_console_drivers is being changed only for listed
consoles.

Suggested-by: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Link: http://lkml.kernel.org/r/20200203133130.11591-6-andriy.shevchenko@linux.intel.com
To: linux-kernel@vger.kernel.org
To: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
  • Loading branch information
Andy Shevchenko authored and Petr Mladek committed Feb 11, 2020
1 parent bb72e39 commit e78bedb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kernel/printk/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2836,7 +2836,10 @@ int unregister_console(struct console *console)
}
}

if (!res && (console->flags & CON_EXTENDED))
if (res)
goto out_disable_unlock;

if (console->flags & CON_EXTENDED)
nr_ext_console_drivers--;

/*
Expand All @@ -2849,6 +2852,13 @@ int unregister_console(struct console *console)
console->flags &= ~CON_ENABLED;
console_unlock();
console_sysfs_notify();

return res;

out_disable_unlock:
console->flags &= ~CON_ENABLED;
console_unlock();

return res;
}
EXPORT_SYMBOL(unregister_console);
Expand Down

0 comments on commit e78bedb

Please sign in to comment.