]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
printk: fix return value of printk.devkmsg __setup handler
authorRandy Dunlap <rdunlap@infradead.org>
Mon, 28 Feb 2022 22:05:56 +0000 (14:05 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:38:28 +0000 (14:38 +0200)
commit31bd4303056d07f3e9447f11f830bc0896d4f247
tree090c614a4c897ca4b07d02ba7fe13d9c343af8f5
parent7ed7e7b232cf0e3c0e9d73af58492a09b86a8b82
printk: fix return value of printk.devkmsg __setup handler

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b665eae7a788c5e2bc10f9ac3c0137aa0ad1fc97 ]

If an invalid option value is used with "printk.devkmsg=<value>",
it is silently ignored.
If a valid option value is used, it is honored but the wrong return
value (0) is used, indicating that the command line option had an
error and was not handled. This string is not added to init's
environment strings due to init/main.c::unknown_bootoption()
checking for a '.' in the boot option string and then considering
that string to be an "Unused module parameter".

Print a warning message if a bad option string is used.
Always return 1 from the __setup handler to indicate that the command
line option has been handled.

Fixes: 750afe7babd1 ("printk: add kernel parameter to control writes to /dev/kmsg")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Cc: Borislav Petkov <bp@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: John Ogness <john.ogness@linutronix.de>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20220228220556.23484-1-rdunlap@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f64c5b235b474ca4aa5ffab32474ec62fa213ac7)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
kernel/printk/printk.c