]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branches 'acpi-button', 'acpica' and 'acpi-sysfs'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 2 Jun 2017 22:03:29 +0000 (00:03 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 2 Jun 2017 22:03:29 +0000 (00:03 +0200)
* acpi-button:
  Revert "ACPI / button: Change default behavior to lid_init_state=open"

* acpica:
  ACPICA: Tables: Fix regression introduced by a too early mechanism enabling

* acpi-sysfs:
  ACPI / sysfs: fix acpi_get_table() leak / acpi-sysfs denial of service

1  2  3  4 
drivers/acpi/button.c
drivers/acpi/sysfs.c

diff --combined drivers/acpi/button.c
index 25aba9b107dd51db522225b5171e7017a5a3ec9d,e19f530f1083a13732328516925e3bbeb6493e14,668137e4a0697cf230b074e13cbb6dd255c7bf59,668137e4a0697cf230b074e13cbb6dd255c7bf59..9ad8cdb58743b765a6daa615729d78745d70af30
    
    #define ACPI_BUTTON_LID_INIT_IGNORE 0x00
    #define ACPI_BUTTON_LID_INIT_OPEN   0x01
  ++#define ACPI_BUTTON_LID_INIT_METHOD 0x02
    
    #define _COMPONENT          ACPI_BUTTON_COMPONENT
    ACPI_MODULE_NAME("button");
@@@@@ -113,7 -113,7 -112,7 -112,7 +113,7 @@@@@ struct acpi_button 
    
    static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier);
    static struct acpi_device *lid_device;
- --static u8 lid_init_state = ACPI_BUTTON_LID_INIT_OPEN;
+ ++static u8 lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
    
    static unsigned long lid_report_interval __read_mostly = 500;
    module_param(lid_report_interval, ulong, 0644);
@@@@@ -217,7 -217,7 -216,7 -216,7 +217,7 @@@@@ static int acpi_lid_notify_state(struc
        }
    
        if (state)
 ---            pm_wakeup_event(&device->dev, 0);
 +++            pm_wakeup_hard_event(&device->dev);
    
        ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device);
        if (ret == NOTIFY_DONE)
@@@@@ -377,9 -377,9 -376,6 -376,6 +377,9 @@@@@ static void acpi_lid_initialize_state(s
        case ACPI_BUTTON_LID_INIT_OPEN:
                (void)acpi_lid_notify_state(device, 1);
                break;
  ++    case ACPI_BUTTON_LID_INIT_METHOD:
  ++            (void)acpi_lid_update_state(device);
  ++            break;
        case ACPI_BUTTON_LID_INIT_IGNORE:
        default:
                break;
@@@@@ -402,7 -402,7 -398,7 -398,7 +402,7 @@@@@ static void acpi_button_notify(struct a
                } else {
                        int keycode;
    
 ---                    pm_wakeup_event(&device->dev, 0);
 +++                    pm_wakeup_hard_event(&device->dev);
                        if (button->suspended)
                                break;
    
@@@@@ -534,7 -534,6 -530,6 -530,6 +534,7 @@@@@ static int acpi_button_add(struct acpi_
                lid_device = device;
        }
    
 +++    device_init_wakeup(&device->dev, true);
        printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
        return 0;
    
@@@@@ -564,9 -563,9 -559,6 -559,6 +564,9 @@@@@ static int param_set_lid_init_state(con
        if (!strncmp(val, "open", sizeof("open") - 1)) {
                lid_init_state = ACPI_BUTTON_LID_INIT_OPEN;
                pr_info("Notify initial lid state as open\n");
  ++    } else if (!strncmp(val, "method", sizeof("method") - 1)) {
  ++            lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
  ++            pr_info("Notify initial lid state with _LID return value\n");
        } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) {
                lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE;
                pr_info("Do not notify initial lid state\n");
@@@@@ -580,8 -579,8 -572,6 -572,6 +580,8 @@@@@ static int param_get_lid_init_state(cha
        switch (lid_init_state) {
        case ACPI_BUTTON_LID_INIT_OPEN:
                return sprintf(buffer, "open");
  ++    case ACPI_BUTTON_LID_INIT_METHOD:
  ++            return sprintf(buffer, "method");
        case ACPI_BUTTON_LID_INIT_IGNORE:
                return sprintf(buffer, "ignore");
        default:
diff --combined drivers/acpi/sysfs.c
index 1b5ee1e0e5a3073457b0b15da34aadf292a544ba,cf05ae973381178cc066e1c235c38afb419e1f01,cf05ae973381178cc066e1c235c38afb419e1f01,5180fef9eb4913c347a487741657ecbd31d2fc79..e414fabf73158d77fba356be2c10354647e81a44
@@@@@ -333,14 -333,14 -333,14 -333,17 +333,17 @@@@@ static ssize_t acpi_table_show(struct f
            container_of(bin_attr, struct acpi_table_attr, attr);
        struct acpi_table_header *table_header = NULL;
        acpi_status status;
+++     ssize_t rc;
    
        status = acpi_get_table(table_attr->name, table_attr->instance,
                                &table_header);
        if (ACPI_FAILURE(status))
                return -ENODEV;
    
---     return memory_read_from_buffer(buf, count, &offset,
---                                    table_header, table_header->length);
+++     rc = memory_read_from_buffer(buf, count, &offset, table_header,
+++                     table_header->length);
+++     acpi_put_table(table_header);
+++     return rc;
    }
    
    static int acpi_table_attr_init(struct kobject *tables_obj,
@@@@@ -921,7 -921,7 -921,7 -924,7 +924,7 @@@@@ void acpi_sysfs_add_hotplug_profile(str
    static ssize_t force_remove_show(struct kobject *kobj,
                                 struct kobj_attribute *attr, char *buf)
    {
 ---    return sprintf(buf, "%d\n", !!acpi_force_hot_remove);
 +++    return sprintf(buf, "%d\n", 0);
    }
    
    static ssize_t force_remove_store(struct kobject *kobj,
        if (ret < 0)
                return ret;
    
 ---    lock_device_hotplug();
 ---    acpi_force_hot_remove = val;
 ---    unlock_device_hotplug();
 +++    if (val) {
 +++            pr_err("Enabling force_remove is not supported anymore. Please report to linux-acpi@vger.kernel.org if you depend on this functionality\n");
 +++            return -EINVAL;
 +++    }
        return size;
    }