Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp678685pxb; Tue, 5 Apr 2022 18:26:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEYBmLw39MyH1TvmZnuloBFQY31HcOfphT3TPHZNwrRkcnBcO4q8LxV8B9ixCk+tzQMWbK X-Received: by 2002:a17:906:5cb:b0:6cf:954:d84d with SMTP id t11-20020a17090605cb00b006cf0954d84dmr6072080ejt.560.1649208367163; Tue, 05 Apr 2022 18:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649208367; cv=none; d=google.com; s=arc-20160816; b=xMUivCJhM2EHh3d+mMeY9epADjM6Xu0az9+KOaSogzOMid+L3cIAVOuVRRPIpmNr/j G+divwDFz9u3e5ovNhC+OwvX7Fv5OHrK7O/fbdbEDeEOlLb444QvdG62DkKrm3S2xlvK Q7nvptKdlxzmrCYbqY/vuY0L4kwaR0582BwpSPRw3p7UoPeOHgpkXXOb5bFS170FxFoz VLLVXkf3SK/dMwYp3LlzXvu7qeYchU3kaluDuvsxjwI5LFPM7vvQyKkuZFicX8W0NckT WY+XFD9MAAZ8iUobFsnPo4JZfOAHa21iWKtj+GOdqzRo63IhNTZ7zqF4SBPXtefE6280 6Mgw== 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=ZAYHNBP+NeSBiByJe4ZLypqUa2XMbA7ksZLDoKb066Q=; b=Yf/S30YaLWJtrLSrPs58NSnA1PQTfUq4gkkFpfBKLdcYE1koUtZcIngCgd0nIvdgdo kLcYxuiSDcf0ObFWSCIgwXNOux6LgaHq/EHl5At3paHGyAg+ls86sJ3JNXIey6qDdUMe BAereau3uxxkuJWXgpiD+MhRCDKQk5krSISpOQphrQeb034c5VLNWppt0cn0Ikwl1ep0 kDmRBSLtsgxW7hMGFLt3urAlTygLbjTGlLaUosrnCSkTQI84+T61+TB+fUpH5a7Md30c tcNuoCA7kHi51B+DDraBWI91kQrKtJ99CFiF5pDiLj8e94kQ2TN+BpYZsfQ4/md3Mvq+ PQ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w7GfMlcA; 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 h8-20020a1709067cc800b006df76385b91si10051164ejp.49.2022.04.05.18.25.42; Tue, 05 Apr 2022 18:26:07 -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=w7GfMlcA; 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 S1358842AbiDEL4q (ORCPT + 99 others); Tue, 5 Apr 2022 07:56:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244945AbiDEIwt (ORCPT ); Tue, 5 Apr 2022 04:52:49 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FF4E24BCC; Tue, 5 Apr 2022 01:47:21 -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 sin.source.kernel.org (Postfix) with ESMTPS id B4AECCE1C2B; Tue, 5 Apr 2022 08:47:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0B3BC385A1; Tue, 5 Apr 2022 08:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148438; bh=K3KpOz7kXmndjWfYEJDm29Zc1GUZwo74eJhkKF8o4r4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w7GfMlcAyBqp+LoKfhGpEen+i8BUDPGWC3uwO9A8jUkRXZPuxBhRsOJcrRBfKKDjp RUi/Y6Efd/T+4aZZmlvAyv4rp8UDZ84sOGdV+WjslZpldWd+PtBPE3Ukd73y3P6Rlp CRMH2KIM7kb3S99YkDt5Hr86Z5QOGoK3SWzCbrJ0= 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.16 0358/1017] printk: fix return value of printk.devkmsg __setup handler Date: Tue, 5 Apr 2022 09:21:11 +0200 Message-Id: <20220405070404.912052325@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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.1 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 57b132b658e1..4187946a28f9 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