Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2815904pxb; Mon, 18 Apr 2022 08:49:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwru4/DvI5GqxF7QVYYfmuPEJ3Jw/U2dr9qcTz0hnLs7GIKwMCh71HP+rs+k45b8u5BuORP X-Received: by 2002:a17:906:6a08:b0:6e8:a871:b8d2 with SMTP id qw8-20020a1709066a0800b006e8a871b8d2mr9803666ejc.71.1650296949337; Mon, 18 Apr 2022 08:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650296949; cv=none; d=google.com; s=arc-20160816; b=TilFPq3LGm7W53qIK1vWnqUZastQT9HV4sfs0fokCt033bjLsFHq9+6S6GEMUwspaC 6rZtcTB4HVj3riePw7ZX2RoG29RFiFCpKlKgZQTUPEYn1yPcJ2y490/wbIahqEoSUvmg /A6jpJkbkSMwrx1zNX2fK+Z6f0HgjULsxMzFW9su0uW/IXph+iddRczN5Nm8etDA+Izv fqw0FsehNVFHp1f36ydg2Ddnj64IxW7jrkwTR07IDz789GO7lrYJCGACabuy8QiOMEeO 05lHQUak7dSGUVsxgzdFuJT85WeixLAQcgbNs9rQ+ISUMXc2Diwxqg93D15lgJQ+pNwO rpvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=03tw4zefT+RfMpcxNgKaRuD9C5dqxgdvTWlOS5ulD/0=; b=JgtKwkJhbKjvz+QoNXZFwEYhOmPzQ7HnyI1Gj4lxykvuwgTDHurcQj5GV2h2swfOD3 E9Bbrh4KLOQhxp9MUxyrraCsyMiEaXtgsFQ9OMVczMsjgE68VfGm06YBB5nUOYwrhpZn r76VpXhr5g99htMCkaAwMdRsBMZlNGR/XYa0H2BXoIoR8jAn8yaCWOFnNq6ye6mhVOFY RJ+gaRWtk/MwSLULwAmWG6wLj8bVSG7QKw0HQ81uM4UInEObLoBm8NzU5/xdd9OGS5e/ Hv4Jh9nV7jybB58tfsaeZC3BJy7rAXTNxnNcTc6jYNb3V3nXI8nfOOisNvya0tyIIBf1 7/xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GtFndzNP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a1709062b4800b006e880e59148si6164392ejg.58.2022.04.18.08.48.43; Mon, 18 Apr 2022 08:49:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GtFndzNP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242089AbiDRNrW (ORCPT + 99 others); Mon, 18 Apr 2022 09:47:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243777AbiDRN3G (ORCPT ); Mon, 18 Apr 2022 09:29:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3476D3FD9C; Mon, 18 Apr 2022 05:53:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DAEB4B80D9C; Mon, 18 Apr 2022 12:53:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04CE4C385A1; Mon, 18 Apr 2022 12:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286427; bh=NfLqOsrWMbK1jbckB1cgBjgow7qN005MzMxAbj/BOp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GtFndzNP/weUFv73wTUug7yi5ox1PncZzAH3ENzViN6aF1hsl8Lz6sOUxEe24+qop CH9NJPwiW6cKgBXsrYy9CR2T3EOCjEzbE8G2R1M9EpgxLxrrKhaYZZZ2C/aVKq1Myj TbjSoc3lDf3ICHBwOiwipvsQhBoFB5e7UzsBGDqg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Igor Zhbanov , Borislav Petkov , Andrew Morton , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , John Ogness , Sasha Levin Subject: [PATCH 4.14 081/284] printk: fix return value of printk.devkmsg __setup handler Date: Mon, 18 Apr 2022 14:11:02 +0200 Message-Id: <20220418121212.988637818@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Randy Dunlap [ Upstream commit b665eae7a788c5e2bc10f9ac3c0137aa0ad1fc97 ] If an invalid option value is used with "printk.devkmsg=", 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 Reported-by: Igor Zhbanov Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Cc: Borislav Petkov Cc: Andrew Morton Cc: Petr Mladek Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: John Ogness Reviewed-by: John Ogness Reviewed-by: Sergey Senozhatsky Reviewed-by: Petr Mladek Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20220228220556.23484-1-rdunlap@infradead.org Signed-off-by: Sasha Levin --- kernel/printk/printk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 31b5e7919d62..11173d0b51bc 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -125,8 +125,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: @@ -148,7 +150,7 @@ static int __init control_devkmsg(char *str) */ devkmsg_log |= DEVKMSG_LOG_MASK_LOCK; - return 0; + return 1; } __setup("printk.devkmsg=", control_devkmsg); -- 2.34.1