Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2294491pxp; Mon, 21 Mar 2022 16:08:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgMnNI4QPtl30Kobs5dnFLZU64JS6YT1+95IzQaXwD8t5jlXlZpRS8nZFFJxV8otFPaS8y X-Received: by 2002:a17:90b:1c03:b0:1c7:510e:d0c7 with SMTP id oc3-20020a17090b1c0300b001c7510ed0c7mr1552944pjb.107.1647904089004; Mon, 21 Mar 2022 16:08:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647904089; cv=none; d=google.com; s=arc-20160816; b=a4HOQIaBfFTODIsJCzQYkXsq24VngrsJ6iwPEDS/AqT4Ml6+TL7nJX3mEx/M0bLKOc o8TOnbW1d8Gp9LyYJsVQ9fyCnsKHXW0HhQTOD7T60EiRyI67NxfnMpe3LB+d0JWUllk6 Gw9XvgRtymddMuXjd8CG4x6YhPp/d/o5KZvU6s4n24xZMrC08SsPDbtaukG0EW9TWBSx O86BFUKd64/N2xqLNj1GrgljvFNt6grkSdZzb3cMwrxK2827ushyUZgvdvpyhU4zaawo XB3sW24+zkBKbjVayGP4MMgZX1mZksIKMQPCD0Dz6IDvD70FeK73OXIOVuPa3ZC6qaUs uNOw== 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=ohlJzD8XsmCt/ZCd5m5e0FxRzbcTJA0hYWAwJwoDX1g=; b=tCnghvo8B1fN4SPmqYdVksfwlqg1+8WLBQMAXz14uv5vCPV54SFSM7ob1Y0Jdd40Ru JiCM3bVkoTGoKOXBvs4kj1GiNk1xF9kjvk2bjBAn5/unXDVq4esnrp9GRmBRgVIMRMWV /uUVi5UUOWggk0Njlxkv/ADzTGiHOXl1QqjzlrzUcfSqRCJZu9CKzeKRy1gn8Tl5WY6C dFunNxlP3JTqv/x7qziou7jA+EP1wxKHGzS1KXr/h67Sp8MaXS2eYDbneqXOM/c7xrcD 1xX9uBFgl0e6odsCSKZDO5B6S5ngmKXFtPI+TDlCQPxluN2nYHx0dudIQ3vjIg5O5Tsc K7HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kn9rVg5l; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id u37-20020a632365000000b003816043eebbsi15071811pgm.176.2022.03.21.16.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:08:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kn9rVg5l; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3CD133FA7BC; Mon, 21 Mar 2022 15:06:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351797AbiCUOLr (ORCPT + 99 others); Mon, 21 Mar 2022 10:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348893AbiCUOEG (ORCPT ); Mon, 21 Mar 2022 10:04:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 955EE33378; Mon, 21 Mar 2022 07:01:17 -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 dfw.source.kernel.org (Postfix) with ESMTPS id BEF3B6129A; Mon, 21 Mar 2022 14:01:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A33D2C340E8; Mon, 21 Mar 2022 14:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871276; bh=+5XscdXFlROL7LE0XhkkVwHD8z4u39zM1wNi9pM8m7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kn9rVg5lE159ethtuUykJ2miKMCzR67Cv971xUnvF7R4yr58o8ASHNYT7cM2MF6XR iWVNNSTy9FssvwaIfzkNrM3/kSvyxh4AUVbr3c0HJrM6hitefPhLXNSSJ+rP5kC6Gn Ym61tZ2+fOGhCaO/ZgIeU2uxeIxN6I+6uhQOaZEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Igor Zhbanov , Ard Biesheuvel , linux-efi@vger.kernel.org, Lukas Wunner , Octavian Purdila , "Rafael J. Wysocki" , Matt Fleming , Sasha Levin Subject: [PATCH 5.15 06/32] efi: fix return value of __setup handlers Date: Mon, 21 Mar 2022 14:52:42 +0100 Message-Id: <20220321133220.747644115@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133220.559554263@linuxfoundation.org> References: <20220321133220.559554263@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=-3.1 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=unavailable 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 9feaf8b387ee0ece9c1d7add308776b502a35d0c ] When "dump_apple_properties" is used on the kernel boot command line, it causes an Unknown parameter message and the string is added to init's argument strings: Unknown kernel command line parameters "dump_apple_properties BOOT_IMAGE=/boot/bzImage-517rc6 efivar_ssdt=newcpu_ssdt", will be passed to user space. Run /sbin/init as init process with arguments: /sbin/init dump_apple_properties with environment: HOME=/ TERM=linux BOOT_IMAGE=/boot/bzImage-517rc6 efivar_ssdt=newcpu_ssdt Similarly when "efivar_ssdt=somestring" is used, it is added to the Unknown parameter message and to init's environment strings, polluting them (see examples above). Change the return value of the __setup functions to 1 to indicate that the __setup options have been handled. Fixes: 58c5475aba67 ("x86/efi: Retrieve and assign Apple device properties") Fixes: 475fb4e8b2f4 ("efi / ACPI: load SSTDs from EFI variables") Signed-off-by: Randy Dunlap Reported-by: Igor Zhbanov Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Cc: Ard Biesheuvel Cc: linux-efi@vger.kernel.org Cc: Lukas Wunner Cc: Octavian Purdila Cc: "Rafael J. Wysocki" Cc: Matt Fleming Link: https://lore.kernel.org/r/20220301041851.12459-1-rdunlap@infradead.org Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin --- drivers/firmware/efi/apple-properties.c | 2 +- drivers/firmware/efi/efi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi/apple-properties.c index 4c3201e290e2..ea84108035eb 100644 --- a/drivers/firmware/efi/apple-properties.c +++ b/drivers/firmware/efi/apple-properties.c @@ -24,7 +24,7 @@ static bool dump_properties __initdata; static int __init dump_properties_enable(char *arg) { dump_properties = true; - return 0; + return 1; } __setup("dump_apple_properties", dump_properties_enable); diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 9fa86288b78a..e3df82d5d37a 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -209,7 +209,7 @@ static int __init efivar_ssdt_setup(char *str) memcpy(efivar_ssdt, str, strlen(str)); else pr_warn("efivar_ssdt: name too long: %s\n", str); - return 0; + return 1; } __setup("efivar_ssdt=", efivar_ssdt_setup); -- 2.34.1