Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp981009pxb; Wed, 6 Apr 2022 05:58:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL4kuIsOpd+cz3b4so99wRYyxPV4szYnOWwuV8U+gzS338F+emP598VCu3QbmIOWT/gKlG X-Received: by 2002:a63:5564:0:b0:399:1d7c:80a1 with SMTP id f36-20020a635564000000b003991d7c80a1mr6778240pgm.203.1649249922251; Wed, 06 Apr 2022 05:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649249922; cv=none; d=google.com; s=arc-20160816; b=nKTWC1JKNHw7uW06UvIE963X+U4yIpaWwRnSEVuJbcNEigDBDcZBYxO3J9bxKksBQ0 CS5zEHdeJMgk3y6XDBCGd9kRUBad44BLFcVVhgmkPlknZPTcqFTenPBRXAKSwWT2N0v9 Q0li36MmkRGSXuSsY7yRAnybQmgNQ61iFSTpRSuveSusLqIrYHN6KuVL+1Mk9mcLKFQt a55M/TByRfzkl3PNXQ6HqZHqFsOIXvcz+F8sjdOpyw8b+y0EYsPI7h0u1ccp7AKERHwn bJCqjPGTQJ3O1m8YnRF0eIXe6klG7RZj1jfaQotEFVKOZM17mg3GRRdtZliBJaWnsS0h KyPQ== 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=kH8ZBh4iBl1YJyCwcVcoWJ9eXC+nG13YE7hOeG+Fhz8=; b=SJNmlBY1UCCmENNGdMzk7JdRzVowUn8R3mGWmsY8aQp37dKM2U5TH48iBhueCrGzYM j5GVdzR/LNvSTmMrQ+gtvYjLxx/1VtUxrzVrwSjwaakCFrtOnKnz69+2NBNyk81+Fc3A adGB4Hdd7FclCpAKFCXEpIDM6pmpVcnDTwu85IPPbQDHj/RkN959rqlaK1snQZLWi9+E 2Rm+2lSFkMGN/jhbjvzS65h4UQPJ4lYxIo/NdeZxzrZace9wGKAke7L/B2kpqohDbDvU Wp9l/eHUKieKPRjvvcib3x4WMvMTos2j2KsLy6auaTfU+6yXCnrJ24as+LA0fOnHHAnM VLYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Do7P9UC8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p33-20020a056a000a2100b004fdf66ab38asi10712987pfh.119.2022.04.06.05.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:58:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Do7P9UC8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 63BB1587DA5; Wed, 6 Apr 2022 03:10:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443355AbiDEWUX (ORCPT + 99 others); Tue, 5 Apr 2022 18:20:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348309AbiDEJr2 (ORCPT ); Tue, 5 Apr 2022 05:47:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48CDB6BDCA; Tue, 5 Apr 2022 02:33:40 -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 BFCCDB81C85; Tue, 5 Apr 2022 09:33:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0927C385A0; Tue, 5 Apr 2022 09:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151218; bh=+8O6INW6CYRSm0dNRMe8Vhn2Otc3I/NdulKbBHar9us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Do7P9UC8Nc1cDpuEkRIW3Ds9WeEl5a2CRNbOad3/r+BfaYxMDxnqcdZ83DxtbiuzW 0r76Lyit8npSMjV1RyW/8cXw/vHJVwvmqXmlQ2+u3mLp44rDX/4JbSKlNLgi6txRhZ 4CtcNoMEh/ZkIKvU6EF6s6fe+x3UUwbOAXJMQPss= 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 5.15 337/913] printk: fix return value of printk.devkmsg __setup handler Date: Tue, 5 Apr 2022 09:23:19 +0200 Message-Id: <20220405070349.950252709@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 99221b016c68..7aeb13542ce7 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); -- 2.34.1