aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware/google
AgeCommit message (Collapse)AuthorFilesLines
2020-09-29efi: gsmi: fix false dependency on CONFIG_EFI_VARSArd Biesheuvel2-5/+5
The gsmi code does not actually rely on CONFIG_EFI_VARS, since it only uses the efivars abstraction that is included unconditionally when CONFIG_EFI is defined. CONFIG_EFI_VARS controls the inclusion of the code that exposes the sysfs entries, and which has been deprecated for some time. Signed-off-by: Ard Biesheuvel <[email protected]>
2020-06-15firmware: google: vpd: Replace zero-length array with flexible-array memberGustavo A. R. Silva1-1/+1
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://github.com/KSPP/linux/issues/21 Signed-off-by: Gustavo A. R. Silva <[email protected]>
2020-06-15firmware: google: memconsole: Replace zero-length array with flexible-array ↵Gustavo A. R. Silva1-1/+1
member There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://github.com/KSPP/linux/issues/21 Signed-off-by: Gustavo A. R. Silva <[email protected]>
2020-01-14firmware: google: Probe for a GSMI handler in firmwareArthur Heymans1-0/+19
Currently this driver is loaded if the DMI string matches coreboot and has a proper smi_command in the ACPI FADT table, but a GSMI handler in SMM is an optional feature in coreboot. So probe for a SMM GSMI handler before initializing the driver. If the smihandler leaves the calling argument in %eax in the SMM save state untouched that generally means the is no handler for GSMI. Signed-off-by: Arthur Heymans <[email protected]> Signed-off-by: Patrick Rudolph <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-01-14firmware: google: Unregister driver_info on failure and exit in gsmiArthur Heymans1-0/+6
Fix a bug where the kernel module couldn't be loaded after unloading, as the platform driver wasn't released on exit. Signed-off-by: Arthur Heymans <[email protected]> Signed-off-by: Patrick Rudolph <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-01-14firmware: google: Release devices before unregistering the busPatrick Rudolph1-0/+7
Fix a bug where the kernel module can't be loaded after it has been unloaded as the devices are still present and conflicting with the to be created coreboot devices. Signed-off-by: Patrick Rudolph <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-10-11firmware: google: increment VPD key_len properlyBrian Norris1-1/+1
Commit 4b708b7b1a2c ("firmware: google: check if size is valid when decoding VPD data") adds length checks, but the new vpd_decode_entry() function botched the logic -- it adds the key length twice, instead of adding the key and value lengths separately. On my local system, this means vpd.c's vpd_section_create_attribs() hits an error case after the first attribute it parses, since it's no longer looking at the correct offset. With this patch, I'm back to seeing all the correct attributes in /sys/firmware/vpd/... Fixes: 4b708b7b1a2c ("firmware: google: check if size is valid when decoding VPD data") Cc: <[email protected]> Cc: Hung-Te Lin <[email protected]> Signed-off-by: Brian Norris <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-09-04firmware: google: check if size is valid when decoding VPD dataHung-Te Lin3-28/+37
The VPD implementation from Chromium Vital Product Data project used to parse data from untrusted input without checking if the meta data is invalid or corrupted. For example, the size from decoded content may be negative value, or larger than whole input buffer. Such invalid data may cause buffer overflow. To fix that, the size parameters passed to vpd_decode functions should be changed to unsigned integer (u32) type, and the parsing of entry header should be refactored so every size field is correctly verified before starting to decode. Fixes: ad2ac9d5c5e0 ("firmware: Google VPD: import lib_vpd source files") Signed-off-by: Hung-Te Lin <[email protected]> Cc: stable <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-06-09Merge 5.2-rc4 into char-misc-nextGreg Kroah-Hartman12-90/+12
We want the char/misc driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 287Thomas Gleixner10-90/+10
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license v2 0 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 23 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Alexios Zavras <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-24firmware: google: coreboot: Drop unnecessary headersStephen Boyd4-4/+1
These headers aren't used by the files they're included in, so drop them. The memconsole file uses memremap() though, so include io.h there so that the include is explicit. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Guenter Roeck <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-24firmware: google: memconsole: Drop global func pointerStephen Boyd1-3/+5
We can store this function pointer directly in the bin_attribute structure's private field. Do this to save one global pointer. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Guenter Roeck <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-24firmware: google: memconsole: Drop __iomem on memremap memoryStephen Boyd1-2/+2
memremap() doesn't return __iomem marked memory, so drop the marking here. This makes static analysis tools like sparse happy again. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Guenter Roeck <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-24firmware: google: memconsole: Use devm_memremap()Stephen Boyd1-6/+3
Use the devm version of memremap so that we can delete the unmapping code in driver remove, but more importantly so that we can unmap this memory region if memconsole_sysfs_init() errors out for some reason. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Guenter Roeck <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-24firmware: google: Add a module_coreboot_driver() macro and use itStephen Boyd4-39/+13
Remove some boiler plate code we have in three drivers with a single line each time. This also gets us a free assignment of the driver .owner field, making these drivers work better as modules. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Guenter Roeck <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner1-0/+1
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-21treewide: Add SPDX license identifier for more missed filesThomas Gleixner1-0/+1
Add SPDX license identifiers to all files which: - Have no license information of any form - Have MODULE_LICENCE("GPL*") inside which was used in the initial scan/conversion to ignore the file These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-28firmware: vpd: Drop __iomem usage for memremap() memoryStephen Boyd1-2/+2
memremap() doesn't return an iomem pointer, so we can just use memcpy() and drop the __iomem annotation here. This silences a sparse warning. Cc: Guenter Roeck <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Anton Vasilyev <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-10-15gsmi: Add GSMI commands to log S0ix infoFurquan Shaikh1-1/+92
Add new GSMI commands (GSMI_CMD_LOG_S0IX_SUSPEND = 0xa, GSMI_CMD_LOG_S0IX_RESUME = 0xb) that allow firmware to log any information during S0ix suspend/resume paths. Traditional ACPI suspend S3 involves BIOS both during the suspend and the resume paths. However, modern suspend type like S0ix does not involve firmware on either of the paths. This command gives the firmware an opportunity to log any required information about the suspend and resume operations e.g. wake sources. Additionally, this change adds a module parameter to allow platforms to specifically enable S0ix logging if required. This prevents any other platforms from unnecessarily making a GSMI call which could have any side-effects. Tested by verifying that wake sources are correctly logged in eventlog. Signed-off-by: Furquan Shaikh <[email protected]> Reviewed-by: Aaron Durbin <[email protected]> Reviewed-by: Rajat Jain <[email protected]> Signed-off-by: Furquan Shaikh <[email protected]> Tested-by: Furquan Shaikh <[email protected]> Reviewed-by: Aaron Durbin <[email protected]> [zwisler: update changelog for upstream] Signed-off-by: Ross Zwisler <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-10-15gsmi: Remove autoselected dependency on EFI and EFI_VARSDuncan Laurie2-7/+15
Instead of selecting EFI and EFI_VARS automatically when GSMI is enabled let that portion of the driver be conditionally compiled if EFI and EFI_VARS are enabled. This allows the rest of the driver (specifically event log) to be used if EFI_VARS is not enabled. To test: 1) verify that EFI_VARS is not automatically selected when CONFIG_GOOGLE_GSMI is enabled 2) verify that the kernel boots on Link and that GSMI event log is still available and functional 3) specifically boot the kernel on Alex to ensure it does not try to load efivars and that gsmi also does not load because it is not in the supported DMI table Signed-off-by: Duncan Laurie <[email protected]> Reviewed-by: Olof Johansson <[email protected]> Signed-off-by: Benson Leung <[email protected]> Signed-off-by: Ben Zhang <[email protected]> Signed-off-by: Filipe Brandenburger <[email protected]> Signed-off-by: Furquan Shaikh <[email protected]> Tested-by: Furquan Shaikh <[email protected]> Reviewed-by: Aaron Durbin <[email protected]> [zwisler: update changelog for upstream] Signed-off-by: Ross Zwisler <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-10-15gsmi: Add coreboot to list of matching BIOS vendorsDuncan Laurie1-0/+6
In order to use this coreboot needs board support for: CONFIG_ELOG=y CONFIG_ELOG_GSMI=y And the kernel driver needs enabled: CONFIG_GOOGLE_GSMI=y To test, verify that clean shutdown event is added to the log: > mosys eventlog list | grep 'Clean Shutdown' 11 | 2012-06-25 09:49:24 | Kernl Event | Clean Shutdown Signed-off-by: Duncan Laurie <[email protected]> Reviewed-by: Vadim Bendebury <[email protected]> Reviewed-by: Stefan Reinauer <[email protected]> Signed-off-by: Furquan Shaikh <[email protected]> Tested-by: Furquan Shaikh <[email protected]> Reviewed-by: Aaron Durbin <[email protected]> Reviewed-by: Justin TerAvest <[email protected]> [zwisler: update changelog for upstream] Signed-off-by: Ross Zwisler <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-10-15gsmi: Fix bug in append_to_eventlog sysfs handlerDuncan Laurie1-3/+2
The sysfs handler should return the number of bytes consumed, which in the case of a successful write is the entire buffer. Also fix a bug where param.data_len was being set to (count - (2 * sizeof(u32))) instead of just (count - sizeof(u32)). The latter is correct because we skip over the leading u32 which is our param.type, but we were also incorrectly subtracting sizeof(u32) on the line where we were actually setting param.data_len: param.data_len = count - sizeof(u32); This meant that for our example event.kernel_software_watchdog with total length 10 bytes, param.data_len was just 2 prior to this change. To test, successfully append an event to the log with gsmi sysfs. This sample event is for a "Kernel Software Watchdog" > xxd -g 1 event.kernel_software_watchdog 0000000: 01 00 00 00 ad de 06 00 00 00 > cat event.kernel_software_watchdog > /sys/firmware/gsmi/append_to_eventlog > mosys eventlog list | tail -1 14 | 2012-06-25 10:14:14 | Kernl Event | Software Watchdog Signed-off-by: Duncan Laurie <[email protected]> Reviewed-by: Vadim Bendebury <[email protected]> Reviewed-by: Stefan Reinauer <[email protected]> Signed-off-by: Furquan Shaikh <[email protected]> Tested-by: Furquan Shaikh <[email protected]> Reviewed-by: Aaron Durbin <[email protected]> Reviewed-by: Justin TerAvest <[email protected]> [zwisler: updated changelog for 2nd bug fix and upstream] Signed-off-by: Ross Zwisler <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-25firmware: vpd: fix spelling mistake "partion" -> "partition"Colin Ian King1-1/+1
Trivial fix to spelling mistake in comment Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-14firmware: coreboot: Only populate devices in coreboot_table_init()Stephen Boyd1-38/+29
This function checks the header for sanity, registers a bus, and populates devices for each coreboot table entry. Let's just populate devices here and pull the other bits up into the caller so that this function can be repurposed for pure device creation and registration. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Suggested-by: Julius Werner <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-14firmware: coreboot: Remap RAM with memremap() instead of ioremap()Stephen Boyd1-21/+19
This is all system memory, so we shouldn't be mapping this all with ioremap() as these aren't I/O regions. Instead, they're memory regions so we should use memremap(). Pick MEMREMAP_WB so we can map memory from RAM directly if that's possible, otherwise it falls back to ioremap_cache() like is being done here already. This also nicely silences the sparse warnings in this code and reduces the need to copy anything around anymore. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-14firmware: coreboot: Collapse platform drivers into bus coreStephen Boyd6-176/+72
The DT based and ACPI based platform drivers here do the same thing; map some memory and hand it over to the coreboot bus to populate devices. The only major difference is that the DT based driver doesn't map the coreboot table header to figure out how large of a region to map for the whole coreboot table and it uses of_iomap() instead of ioremap_cache(). A cached or non-cached mapping shouldn't matter here and mapping some smaller region first before mapping the whole table is just more work but should be OK. In the end, we can remove two files and combine the code all in one place making it easier to reason about things. We leave the old Kconfigs in place for a little while longer but make them hidden and select the previously hidden config option. This way users can upgrade without having to know to reselect this config in the future. Later on we can remove the old hidden configs. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-14firmware: coreboot: Make bus registration symmetricStephen Boyd1-6/+8
The bus is registered in module_init() but is unregistered when the platform driver remove() function calls coreboot_table_exit(). That isn't symmetric and it causes the bus to appear on systems that compile this code in, even when there isn't any coreboot firmware on the device. Let's move the registration to the coreboot_table_init() function so that it matches the exit path. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-14firmware: coreboot: Unmap ioregion after device populationStephen Boyd1-3/+4
Both callers of coreboot_table_init() ioremap the pointer that comes in but they don't unmap the memory on failure. Both of them also fail probe immediately with the return value of coreboot_table_init(), leaking a mapping when it fails. The mapping isn't necessary at all after devices are populated either, so we can just drop the mapping here when we exit the function. Let's do that to simplify the code a bit and plug the leak. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Fixes: 570d30c2823f ("firmware: coreboot: Expose the coreboot table as a bus") Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-14firmware: coreboot: Let OF core populate platform deviceStephen Boyd1-25/+3
Now that the /firmware/coreboot node in DT is populated by the core DT platform code with commit 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()") we should and can remove the platform device creation here. Otherwise, the of_platform_device_create() call will fail, the coreboot of driver won't be registered, and this driver will never bind. At the same time, we should move this driver to use MODULE_DEVICE_TABLE so that module auto-load works properly when the coreboot device is auto-populated and we should drop the of_node handling that was presumably placed here to hold a reference to the DT node created during module init that no longer happens. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Reviewed-by: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Reviewed-by: Sudeep Holla <[email protected]> Fixes: 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()") Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-14firmware: google: make structure gsmi_dev staticColin Ian King1-1/+1
The structure gsmi_dev is local to the source and does not need to be in global scope, so make it static. Cleans up sparse warning: symbol 'gsmi_dev' was not declared. Should it be static? Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Jean Delvare <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-08-02firmware: vpd: Fix section enabled flag on vpd_section_destroyAnton Vasilyev1-1/+4
static struct ro_vpd and rw_vpd are initialized by vpd_sections_init() in vpd_probe() based on header's ro and rw sizes. In vpd_remove() vpd_section_destroy() performs deinitialization based on enabled flag, which is set to true by vpd_sections_init(). This leads to call of vpd_section_destroy() on already destroyed section for probe-release-probe-release sequence if first probe performs ro_vpd initialization and second probe does not initialize it. The patch adds changing enabled flag on vpd_section_destroy and adds cleanup on the error path of vpd_sections_init. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Anton Vasilyev <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-04-23firmware: coreboot: Add coreboot framebuffer driverSamuel Holland4-0/+146
Register a simplefb framebuffer when the coreboot table contains a framebuffer entry. Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-04-23firmware: coreboot: Remove unused coreboot_table_findSamuel Holland2-46/+0
Now that all users of the coreboot_table_find function have been updated to hang off the coreboot table bus instead, remove it. Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-04-23firmware: vpd: Probe via coreboot busSamuel Holland1-31/+12
Remove the ad-hoc coreboot table search. Now the driver will only be probed when the necessary coreboot table entry has already been found. Furthermore, since the coreboot bus takes care of creating the device, a separate platform device is no longer needed. Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-04-23firmware: memconsole: Probe via coreboot busSamuel Holland1-32/+17
Remove the ad-hoc coreboot table search. Now the driver will only be probed when the necessary coreboot table entry has already been found. Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-04-23firmware: coreboot: Expose the coreboot table as a busSamuel Holland4-18/+156
This simplifies creating device drivers for hardware or information described in the coreboot table. It also avoids needing to search through the table every time a driver is loaded. Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-28firmware: vpd: Fix platform driver and device registration/unregistrationGuenter Roeck1-5/+13
The driver exit function needs to unregister both platform device and driver. Also, during registration, register driver first and perform error checks. Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver") Signed-off-by: Guenter Roeck <[email protected]> Cc: stable <[email protected]> Tested-by: Randy Dunlap <[email protected]> Reviewed-by: Dmitry Torokhov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-28firmware: vpd: Tie firmware kobject to device lifetimeGuenter Roeck1-6/+13
It doesn't make sense to have /sys/firmware/vpd if the device is not instantiated, so tie its lifetime to the device. Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver") Signed-off-by: Guenter Roeck <[email protected]> Cc: stable <[email protected]> Reviewed-by: Dmitry Torokhov <[email protected]> Tested-by: Randy Dunlap <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-28firmware: vpd: Destroy vpd sections in remove functionGuenter Roeck1-2/+9
vpd sections are initialized during probe and thus should be destroyed in the remove function. Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver") Cc: stable <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Dmitry Torokhov <[email protected]> Tested-by: Randy Dunlap <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman1-0/+1
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <[email protected]> Reviewed-by: Philippe Ombredanne <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-09-14dmi: Mark all struct dmi_system_id instances constChristoph Hellwig2-2/+2
... and __initconst if applicable. Based on similar work for an older kernel in the Grsecurity patch. [JD: fix toshiba-wmi build] [JD: add htcpen] [JD: move __initconst where checkscript wants it] Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jean Delvare <[email protected]>
2017-08-28firmware: vpd: use memunmap instead of iounmapPan Bian1-5/+5
In functions vpd_sections_init() and vpd_section_init(), iounmap() is used to unmap memory. However, in these cases, memunmap() should be used. Signed-off-by: Pan Bian <[email protected]> Reviewed-by: Dmitry Torokhov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-06-12Merge 4.12-rc5 into char-misc-nextGreg Kroah-Hartman1-4/+4
We want the char/misc driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-27Revert "firmware: vpd: remove platform driver"Dmitry Torokhov1-16/+28
This reverts commit 7975bd4cca05a99aa14964cfa22366ee64da50ad, because VPD relies on driver core to handle deferrals returned by coreboot_table_find(). Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-25firmware: vpd: remove platform driverDmitry Torokhov1-28/+16
There is no reason why VPD should register platform device and driver, given that we do not use their respective kobjects to attach attributes, nor do we need suspend/resume hooks, or any other features of device core. Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-25firmware: vpd: do not clear statically allocated dataDmitry Torokhov1-3/+0
ro_vpd and rw_vpd are static module-scope variables that are guaranteed to be initialized with zeroes, there is no need for explicit memset(). Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-25firmware: vpd: use kasprintf() when forming name of 'raw' attributeDmitry Torokhov1-16/+15
When creating name for the "raw" attribute, let's switch to using kaspeintf() instead of doing it by hand. Also make sure we handle errors. Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-25firmware: vpd: use kdtrndup when copying section keyDmitry Torokhov1-3/+2
Instead of open-coding kstrndup with kzalloc + memcpy, let's use the helper. Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-25firmware: vpd: do not leak kobjectsDmitry Torokhov1-2/+2
kobject_del() only unlinks kobject, we need to use kobject_put() to make sure kobject will go away completely. Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver") Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-05-25firmware: vpd: avoid potential use-after-free when destroying sectionDmitry Torokhov1-1/+1
We should not free info->key before we remove sysfs attribute that uses this data as its name. Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver") Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>