mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
hwmon fixes for v7.1-rc4
- asus_atk0110, acpi_power_meter: Add missing NULL pointer checks - lm90: Fix locking and UAF issues - sy7636a: Fix sysfs attribute name in documentation -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmoI8sIACgkQyx8mb86f mYEJ7Q//SOEdVoW7nubLZzjSHqlip7dIQe+m/scLRtMpZfM+T+FRsq8MT5VQuuOy YPsfl6AON+8oWwpbDy8k06tfDXzTOKg/aqzFwMOnM0WqnCpV2DxNOqUSgUdKaWH0 Jyh97Jvm/KRyLdjbTCEHMrpmjylVcoK8eBBP9YLijMWWG9etATZxlTRpg8axPLCV 9e2+NiMhDvDS2rPun78NWQPka9yLgxJFTuY0PzkdFjhaBcze/w1R9FDoO/ADPexD +diea3Vh+zDJIx9W+U2gRo4q0y44WZfdC/kC3Vesrrok5lFZOvY/mSG4g3o7ZtB1 T970J9Ban+Q+KmPHc/u6+/Kbumy9lF0I/Qk1AFTatPD6eWEFzAiMVuWdMO1S88RS rGwpvGMua0Dpl5oOHhbwtKHv1ZQ4mI1ozNHmm9xt6tLPFYvR42Wz46O4/Z3idFTa YZAzxrsEE/6lWTwWuZx9eIn9LVrFyiJfR+0s/R8avj+ybqW5U2aKlMpixcVVykYW x1TKt91omszIaVaj6S5fsdMoiAh8yLEsEI5Hk2Kcf7Jh2Uj7kufJtNCsNa1+zQz9 lxiGra2WKrKBEgrhv392369LQEiUyGWuU2loL0fQQFC33qTv9MoGKrM25YX8DuFB WjQBXOmOD33mnO5fojqshAa9RXX9AnntQfAYsB89Wz8G/mKMjio= =CZ6D -----END PGP SIGNATURE----- Merge tag 'hwmon-for-v7.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fixes from Guenter Roeck: - asus_atk0110, acpi_power_meter: Add missing NULL pointer checks - lm90: Fix locking and UAF issues - sy7636a: Fix sysfs attribute name in documentation * tag 'hwmon-for-v7.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (lm90) Add lock protection to lm90_alert hwmon: (lm90) Stop work before releasing hwmon device docs: hwmon: sy7636a: fix temperature sysfs attribute name hwmon: (asus_atk0110) Check ACPI_COMPANION() against NULL hwmon: (acpi_power_meter) Check ACPI_COMPANION() against NULL
This commit is contained in:
commit
1405a07192
|
|
@ -22,5 +22,5 @@ The following sensors are supported
|
|||
sysfs-Interface
|
||||
---------------
|
||||
|
||||
temp0_input
|
||||
temp1_input
|
||||
- Temperature of external NTC (milli-degree C)
|
||||
|
|
|
|||
|
|
@ -884,10 +884,14 @@ static void acpi_power_meter_notify(acpi_handle handle, u32 event, void *data)
|
|||
|
||||
static int acpi_power_meter_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||
struct acpi_power_meter_resource *resource;
|
||||
struct acpi_device *device;
|
||||
int res;
|
||||
|
||||
device = ACPI_COMPANION(&pdev->dev);
|
||||
if (!device)
|
||||
return -ENODEV;
|
||||
|
||||
resource = kzalloc_obj(*resource);
|
||||
if (!resource)
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
|
|
@ -1273,15 +1273,20 @@ static int atk_probe(struct platform_device *pdev)
|
|||
struct acpi_buffer buf;
|
||||
union acpi_object *obj;
|
||||
struct atk_data *data;
|
||||
acpi_handle handle;
|
||||
|
||||
dev_dbg(&pdev->dev, "adding...\n");
|
||||
|
||||
handle = ACPI_HANDLE(&pdev->dev);
|
||||
if (!handle)
|
||||
return -ENODEV;
|
||||
|
||||
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
data->dev = &pdev->dev;
|
||||
data->atk_handle = ACPI_HANDLE(&pdev->dev);
|
||||
data->atk_handle = handle;
|
||||
INIT_LIST_HEAD(&data->sensor_list);
|
||||
data->disable_ec = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -736,6 +736,7 @@ struct lm90_data {
|
|||
struct hwmon_chip_info chip;
|
||||
struct delayed_work alert_work;
|
||||
struct work_struct report_work;
|
||||
bool shutdown; /* true if shutting down */
|
||||
bool valid; /* true if register values are valid */
|
||||
bool alarms_valid; /* true if status register values are valid */
|
||||
unsigned long last_updated; /* in jiffies */
|
||||
|
|
@ -1154,6 +1155,9 @@ static void lm90_report_alarms(struct work_struct *work)
|
|||
|
||||
static int lm90_update_alarms_locked(struct lm90_data *data, bool force)
|
||||
{
|
||||
if (data->shutdown)
|
||||
return 0;
|
||||
|
||||
if (force || !data->alarms_valid ||
|
||||
time_after(jiffies, data->alarms_updated + msecs_to_jiffies(data->update_interval))) {
|
||||
struct i2c_client *client = data->client;
|
||||
|
|
@ -2584,15 +2588,23 @@ static void lm90_restore_conf(void *_data)
|
|||
struct lm90_data *data = _data;
|
||||
struct i2c_client *client = data->client;
|
||||
|
||||
cancel_delayed_work_sync(&data->alert_work);
|
||||
cancel_work_sync(&data->report_work);
|
||||
|
||||
/* Restore initial configuration */
|
||||
if (data->flags & LM90_HAVE_CONVRATE)
|
||||
lm90_write_convrate(data, data->convrate_orig);
|
||||
lm90_write_reg(client, LM90_REG_CONFIG1, data->config_orig);
|
||||
}
|
||||
|
||||
static void lm90_stop_work(void *_data)
|
||||
{
|
||||
struct lm90_data *data = _data;
|
||||
|
||||
hwmon_lock(data->hwmon_dev);
|
||||
data->shutdown = true;
|
||||
hwmon_unlock(data->hwmon_dev);
|
||||
cancel_delayed_work_sync(&data->alert_work);
|
||||
cancel_work_sync(&data->report_work);
|
||||
}
|
||||
|
||||
static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
|
||||
{
|
||||
struct device_node *np = client->dev.of_node;
|
||||
|
|
@ -2902,6 +2914,10 @@ static int lm90_probe(struct i2c_client *client)
|
|||
|
||||
data->hwmon_dev = hwmon_dev;
|
||||
|
||||
err = devm_add_action_or_reset(&client->dev, lm90_stop_work, data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (client->irq) {
|
||||
dev_dbg(dev, "IRQ: %d\n", client->irq);
|
||||
err = devm_request_threaded_irq(dev, client->irq,
|
||||
|
|
@ -2930,7 +2946,8 @@ static void lm90_alert(struct i2c_client *client, enum i2c_alert_protocol type,
|
|||
*/
|
||||
struct lm90_data *data = i2c_get_clientdata(client);
|
||||
|
||||
if ((data->flags & LM90_HAVE_BROKEN_ALERT) &&
|
||||
hwmon_lock(data->hwmon_dev);
|
||||
if (!data->shutdown && (data->flags & LM90_HAVE_BROKEN_ALERT) &&
|
||||
(data->current_alarms & data->alert_alarms)) {
|
||||
if (!(data->config & 0x80)) {
|
||||
dev_dbg(&client->dev, "Disabling ALERT#\n");
|
||||
|
|
@ -2939,6 +2956,7 @@ static void lm90_alert(struct i2c_client *client, enum i2c_alert_protocol type,
|
|||
schedule_delayed_work(&data->alert_work,
|
||||
max_t(int, HZ, msecs_to_jiffies(data->update_interval)));
|
||||
}
|
||||
hwmon_unlock(data->hwmon_dev);
|
||||
} else {
|
||||
dev_dbg(&client->dev, "Everything OK\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user