Patch "printk: fix return value of printk.devkmsg __setup handler" has been added to the 5.17-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    printk: fix return value of printk.devkmsg __setup handler

to the 5.17-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     printk-fix-return-value-of-printk.devkmsg-__setup-ha.patch
and it can be found in the queue-5.17 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 09040161a2c609d60a5cf5d3b9c77c9dbf539d86
Author: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Date:   Mon Feb 28 14:05:56 2022 -0800

    printk: fix return value of printk.devkmsg __setup handler
    
    [ 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@xxxxxxxxxxxxx>
    Reported-by: Igor Zhbanov <i.zhbanov@xxxxxxxxxxxx>
    Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@xxxxxxxxxxxx
    Cc: Borislav Petkov <bp@xxxxxxx>
    Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Cc: Petr Mladek <pmladek@xxxxxxxx>
    Cc: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
    Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
    Cc: John Ogness <john.ogness@xxxxxxxxxxxxx>
    Reviewed-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
    Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
    Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
    Signed-off-by: Petr Mladek <pmladek@xxxxxxxx>
    Link: https://lore.kernel.org/r/20220228220556.23484-1-rdunlap@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 82abfaf3c2aa..833e407545b8 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -146,8 +146,10 @@ static int __control_devkmsg(char *str)
 
 static int __init control_devkmsg(char *str)
 {
-	if (__control_devkmsg(str) < 0)
+	if (__control_devkmsg(str) < 0) {
+		pr_warn("printk.devkmsg: bad option string '%s'\n", str);
 		return 1;
+	}
 
 	/*
 	 * Set sysctl string accordingly:
@@ -166,7 +168,7 @@ static int __init control_devkmsg(char *str)
 	 */
 	devkmsg_log |= DEVKMSG_LOG_MASK_LOCK;
 
-	return 0;
+	return 1;
 }
 __setup("printk.devkmsg=", control_devkmsg);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux