]> git.hungrycats.org Git - linux/commitdiff
efi: fix return value of __setup handlers
authorRandy Dunlap <rdunlap@infradead.org>
Tue, 1 Mar 2022 04:18:51 +0000 (20:18 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Mar 2022 08:12:06 +0000 (09:12 +0100)
[ 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 <rdunlap@infradead.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Octavian Purdila <octavian.purdila@intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Link: https://lore.kernel.org/r/20220301041851.12459-1-rdunlap@infradead.org
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/efi/apple-properties.c
drivers/firmware/efi/efi.c

index 0e206c9e0d7ae1eba6675aa86d84ee8e7b706ca9..7ad2d85d7270bffcef8506e29837b080a28901b2 100644 (file)
@@ -23,7 +23,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);
index 415d7b3a59f826f0a8dc0d76a758a4f4d8104e25..8fd74a7501d40d37615fbca9775d8c3219427c8d 100644 (file)
@@ -231,7 +231,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);