diff options
author | Dan Williams <dan.j.williams@intel.com> | 2017-04-03 16:52:14 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-04-13 00:56:41 -0400 |
commit | 3c87f372695592bf86e9dab7b1ec7d439fda577b (patch) | |
tree | 9e230c6b46be7590278ed2c472afc23895d3c155 | |
parent | f2668fa7f6fbb0dfa4eb2e571f8ec0c34bc66b6f (diff) |
acpi, nfit: fix acpi_get_table leak
Calls to acpi_get_table() must be paired with acpi_put_table() to undo
the mapping established by acpi_tb_acquire_table().
It turns out this has no effect in practice since the NFIT will already
be mapped to support the /sys/firmware/acpi/tables/NFIT attribute in
sysfs.
Fixes: 6b11d1d67713 ("ACPI / osl: Remove acpi_get_table_with_size()/early_acpi_os_unmap_memory() users")
Cc: Lv Zheng <lv.zheng@intel.com>
Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/acpi/nfit/core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index c3decdca46f9..53943d6f4214 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
@@ -2831,6 +2831,11 @@ void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev) | |||
2831 | } | 2831 | } |
2832 | EXPORT_SYMBOL_GPL(acpi_nfit_desc_init); | 2832 | EXPORT_SYMBOL_GPL(acpi_nfit_desc_init); |
2833 | 2833 | ||
2834 | static void acpi_nfit_put_table(void *table) | ||
2835 | { | ||
2836 | acpi_put_table(table); | ||
2837 | } | ||
2838 | |||
2834 | static int acpi_nfit_add(struct acpi_device *adev) | 2839 | static int acpi_nfit_add(struct acpi_device *adev) |
2835 | { | 2840 | { |
2836 | struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL }; | 2841 | struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL }; |
@@ -2847,6 +2852,10 @@ static int acpi_nfit_add(struct acpi_device *adev) | |||
2847 | dev_dbg(dev, "failed to find NFIT at startup\n"); | 2852 | dev_dbg(dev, "failed to find NFIT at startup\n"); |
2848 | return 0; | 2853 | return 0; |
2849 | } | 2854 | } |
2855 | |||
2856 | rc = devm_add_action_or_reset(dev, acpi_nfit_put_table, tbl); | ||
2857 | if (rc) | ||
2858 | return rc; | ||
2850 | sz = tbl->length; | 2859 | sz = tbl->length; |
2851 | 2860 | ||
2852 | acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL); | 2861 | acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL); |