You need to sign in or sign up before continuing.
  1. 20 3月, 2020 1 次提交
    • H
      firmware: Add new platform fallback mechanism and firmware_request_platform() · e4c2c0ff
      Hans de Goede 提交于
      In some cases the platform's main firmware (e.g. the UEFI fw) may contain
      an embedded copy of device firmware which needs to be (re)loaded into the
      peripheral. Normally such firmware would be part of linux-firmware, but in
      some cases this is not feasible, for 2 reasons:
      
      1) The firmware is customized for a specific use-case of the chipset / use
      with a specific hardware model, so we cannot have a single firmware file
      for the chipset. E.g. touchscreen controller firmwares are compiled
      specifically for the hardware model they are used with, as they are
      calibrated for a specific model digitizer.
      
      2) Despite repeated attempts we have failed to get permission to
      redistribute the firmware. This is especially a problem with customized
      firmwares, these get created by the chip vendor for a specific ODM and the
      copyright may partially belong with the ODM, so the chip vendor cannot
      give a blanket permission to distribute these.
      
      This commit adds a new platform fallback mechanism to the firmware loader
      which will try to lookup a device fw copy embedded in the platform's main
      firmware if direct filesystem lookup fails.
      
      Drivers which need such embedded fw copies can enable this fallback
      mechanism by using the new firmware_request_platform() function.
      
      Note that for now this is only supported on EFI platforms and even on
      these platforms firmware_fallback_platform() only works if
      CONFIG_EFI_EMBEDDED_FIRMWARE is enabled (this gets selected by drivers
      which need this), in all other cases firmware_fallback_platform() simply
      always returns -ENOENT.
      Reported-by: NDave Olsthoorn <dave@bewaar.me>
      Suggested-by: NPeter Jones <pjones@redhat.com>
      Acked-by: NLuis Chamberlain <mcgrof@kernel.org>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20200115163554.101315-5-hdegoede@redhat.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4c2c0ff
  2. 11 2月, 2020 1 次提交
    • T
      firmware_loader: load files from the mount namespace of init · 901cff7c
      Topi Miettinen 提交于
      I have an experimental setup where almost every possible system
      service (even early startup ones) runs in separate namespace, using a
      dedicated, minimal file system. In process of minimizing the contents
      of the file systems with regards to modules and firmware files, I
      noticed that in my system, the firmware files are loaded from three
      different mount namespaces, those of systemd-udevd, init and
      systemd-networkd. The logic of the source namespace is not very clear,
      it seems to depend on the driver, but the namespace of the current
      process is used.
      
      So, this patch tries to make things a bit clearer and changes the
      loading of firmware files only from the mount namespace of init. This
      may also improve security, though I think that using firmware files as
      attack vector could be too impractical anyway.
      
      Later, it might make sense to make the mount namespace configurable,
      for example with a new file in /proc/sys/kernel/firmware_config/. That
      would allow a dedicated file system only for firmware files and those
      need not be present anywhere else. This configurability would make
      more sense if made also for kernel modules and /sbin/modprobe. Modules
      are already loaded from init namespace (usermodehelper uses kthreadd
      namespace) except when directly loaded by systemd-udevd.
      
      Instead of using the mount namespace of the current process to load
      firmware files, use the mount namespace of init process.
      
      Link: https://lore.kernel.org/lkml/bb46ebae-4746-90d9-ec5b-fce4c9328c86@gmail.com/
      Link: https://lore.kernel.org/lkml/0e3f7653-c59d-9341-9db2-c88f5b988c68@gmail.com/Signed-off-by: NTopi Miettinen <toiwoton@gmail.com>
      Link: https://lore.kernel.org/r/20200123125839.37168-1-toiwoton@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      901cff7c
  3. 24 1月, 2020 1 次提交
  4. 14 11月, 2019 1 次提交
  5. 04 11月, 2019 1 次提交
  6. 11 10月, 2019 1 次提交
  7. 18 6月, 2019 2 次提交
    • T
      firmware: Add support for loading compressed files · 82fd7a81
      Takashi Iwai 提交于
      This patch adds the support for loading compressed firmware files.
      The primary motivation is to reduce the storage size; e.g. currently
      the files in /lib/firmware on my machine counts up to 419MB, while
      they can be reduced to 130MB by file compression.
      
      The patch introduces a new kconfig option CONFIG_FW_LOADER_COMPRESS.
      Even with this option set, the firmware loader still tries to load the
      original firmware file as-is at first, but then falls back to the file
      with ".xz" extension when it's not found, and the decompressed file
      content is returned to the caller of request_firmware().  So, no
      change is needed for the rest.
      
      Currently only XZ format is supported.  A caveat is that the kernel XZ
      helper code supports only CRC32 (or none) integrity check type, so
      you'll have to compress the files via xz -C crc32 option.
      
      Since we can't determine the expanded size immediately from an XZ
      file, the patch re-uses the paged buffer that was used for the
      user-mode fallback; it puts the decompressed content page, which are
      vmapped at the end.  The paged buffer code is conditionally built with
      a new Kconfig that is selected automatically.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82fd7a81
    • T
      firmware: Factor out the paged buffer handling code · 5342e709
      Takashi Iwai 提交于
      This is merely a preparation for the upcoming compressed firmware
      support and no functional changes.  It moves the code to handle the
      paged buffer allocation and mapping out of fallback.c into the main
      code, so that they can be used commonly.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5342e709
  8. 11 6月, 2019 3 次提交
  9. 26 2月, 2019 1 次提交
  10. 30 9月, 2018 1 次提交
  11. 12 9月, 2018 1 次提交
    • R
      firmware: Fix security issue with request_firmware_into_buf() · 422b3db2
      Rishabh Bhatnagar 提交于
      When calling request_firmware_into_buf() with the FW_OPT_NOCACHE flag
      it is expected that firmware is loaded into buffer from memory.
      But inside alloc_lookup_fw_priv every new firmware that is loaded is
      added to the firmware cache (fwc) list head. So if any driver requests
      a firmware that is already loaded the code iterates over the above
      mentioned list and it can end up giving a pointer to other device driver's
      firmware buffer.
      Also the existing copy may either be modified by drivers, remote processors
      or even freed. This causes a potential security issue with batched requests
      when using request_firmware_into_buf.
      
      Fix alloc_lookup_fw_priv to not add to the fwc head list if FW_OPT_NOCACHE
      is set, and also don't do the lookup in the list.
      
      Fixes: 0e742e92 ("firmware: provide infrastructure to make fw caching optional")
      [mcgrof: broken since feature introduction on v4.8]
      
      Cc: stable@vger.kernel.org # v4.8+
      Signed-off-by: NVikram Mulukutla <markivx@codeaurora.org>
      Signed-off-by: NRishabh Bhatnagar <rishabhb@codeaurora.org>
      Signed-off-by: NLuis Chamberlain <mcgrof@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      422b3db2
  12. 14 5月, 2018 4 次提交
  13. 23 3月, 2018 1 次提交
  14. 20 3月, 2018 8 次提交
  15. 15 3月, 2018 1 次提交
    • L
      firmware: enable to split firmware_class into separate target files · ad4365f1
      Luis R. Rodriguez 提交于
      The firmware loader code has grown quite a bit over the years.
      The practice of stuffing everything we need into one file makes
      the code hard to follow.
      
      In order to split the firmware loader code into different components
      we must pick a module name and a first object target file. We must
      keep the firmware_class name to remain compatible with scripts which
      have been relying on the sysfs loader path for years, so the old module
      name stays. We can however rename the C file without affecting the
      module name.
      
      The firmware_class used to represent the idea that the code was a simple
      sysfs firmware loader, provided by the struct class firmware_class.
      The sysfs firmware loader used to be the default, today its only the
      fallback mechanism.
      
      This only renames the target code then to make emphasis of what the code
      does these days. With this change new features can also use a new object
      files.
      Signed-off-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ad4365f1
  16. 08 12月, 2017 1 次提交
    • G
      driver core: add SPDX identifiers to all driver core files · 989d42e8
      Greg Kroah-Hartman 提交于
      It's good to have SPDX identifiers in all files to make it easier to
      audit the kernel tree for correct licenses.
      
      Update the driver core files files with the correct SPDX license
      identifier based on the license text in the file itself.  The SPDX
      identifier is a legally binding shorthand, which can be used instead of
      the full boiler plate text.
      
      This work is based on a script and data from Thomas Gleixner, Philippe
      Ombredanne, and Kate Stewart.
      
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      989d42e8
  17. 29 11月, 2017 11 次提交