• Randy Dunlap's avatar
    efi: fix return value of __setup handlers · 9feaf8b3
    Randy Dunlap authored
    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: 58c5475a ("x86/efi: Retrieve and assign Apple device properties")
    Fixes: 475fb4e8 ("efi / ACPI: load SSTDs from EFI variables")
    Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
    Reported-by: default avatarIgor 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.orgSigned-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    9feaf8b3
apple-properties.c 5.98 KB