Commit f0ae3a50 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'hwmon-for-v6.19-rc2' of...

Merge tag 'hwmon-for-v6.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

 - ltc4282: Fix reset_history file permissions

 - ds620: Update broken Datasheet URL in driver documentation

 - tmp401: Fix overflow caused by default conversion rate value

 - ibmpex: Fix use-after-free in high/low store

 - dell-smm: Limit fan multiplier to avoid overflow

* tag 'hwmon-for-v6.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (ltc4282): Fix reset_history file permissions
  hwmon: (DS620) Update broken Datasheet URL in driver documentation
  hwmon: (tmp401) fix overflow caused by default conversion rate value
  hwmon: (ibmpex) fix use-after-free in high/low store
  hwmon: (dell-smm) Limit fan multiplier to avoid overflow
parents 3ed22a35 b3db91c3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -7,9 +7,9 @@ Supported chips:

    Prefix: 'ds620'

    Datasheet: Publicly available at the Dallas Semiconductor website
    Datasheet: Publicly available at the Analog Devices website

	       http://www.dalsemi.com/
	https://www.analog.com/media/en/technical-documentation/data-sheets/DS620.pdf

Authors:
	Roland Stigge <stigge@antcom.de>
+9 −0
Original line number Diff line number Diff line
@@ -76,6 +76,9 @@
#define DELL_SMM_NO_TEMP	10
#define DELL_SMM_NO_FANS	4

/* limit fan multiplier to avoid overflow */
#define DELL_SMM_MAX_FAN_MULT (INT_MAX / U16_MAX)

struct smm_regs {
	unsigned int eax;
	unsigned int ebx;
@@ -1253,6 +1256,12 @@ static int dell_smm_init_data(struct device *dev, const struct dell_smm_ops *ops
	data->ops = ops;
	/* All options must not be 0 */
	data->i8k_fan_mult = fan_mult ? : I8K_FAN_MULT;
	if (data->i8k_fan_mult > DELL_SMM_MAX_FAN_MULT) {
		dev_err(dev,
			"fan multiplier %u is too large (max %u)\n",
			data->i8k_fan_mult, DELL_SMM_MAX_FAN_MULT);
		return -EINVAL;
	}
	data->i8k_fan_max = fan_max ? : I8K_FAN_HIGH;
	data->i8k_pwm_mult = DIV_ROUND_UP(255, data->i8k_fan_max);

+7 −2
Original line number Diff line number Diff line
@@ -277,6 +277,9 @@ static ssize_t ibmpex_high_low_store(struct device *dev,
{
	struct ibmpex_bmc_data *data = dev_get_drvdata(dev);

	if (!data)
		return -ENODEV;

	ibmpex_reset_high_low_data(data);

	return count;
@@ -508,6 +511,9 @@ static void ibmpex_bmc_delete(struct ibmpex_bmc_data *data)
{
	int i, j;

	hwmon_device_unregister(data->hwmon_dev);
	dev_set_drvdata(data->bmc_device, NULL);

	device_remove_file(data->bmc_device,
			   &sensor_dev_attr_reset_high_low.dev_attr);
	device_remove_file(data->bmc_device, &dev_attr_name.attr);
@@ -521,8 +527,7 @@ static void ibmpex_bmc_delete(struct ibmpex_bmc_data *data)
		}

	list_del(&data->list);
	dev_set_drvdata(data->bmc_device, NULL);
	hwmon_device_unregister(data->hwmon_dev);

	ipmi_destroy_user(data->user);
	kfree(data->sensors);
	kfree(data);
+6 −3
Original line number Diff line number Diff line
@@ -1000,8 +1000,9 @@ static umode_t ltc4282_in_is_visible(const struct ltc4282_state *st, u32 attr)
	case hwmon_in_max:
	case hwmon_in_min:
	case hwmon_in_enable:
	case hwmon_in_reset_history:
		return 0644;
	case hwmon_in_reset_history:
		return 0200;
	default:
		return 0;
	}
@@ -1020,8 +1021,9 @@ static umode_t ltc4282_curr_is_visible(u32 attr)
		return 0444;
	case hwmon_curr_max:
	case hwmon_curr_min:
	case hwmon_curr_reset_history:
		return 0644;
	case hwmon_curr_reset_history:
		return 0200;
	default:
		return 0;
	}
@@ -1039,8 +1041,9 @@ static umode_t ltc4282_power_is_visible(u32 attr)
		return 0444;
	case hwmon_power_max:
	case hwmon_power_min:
	case hwmon_power_reset_history:
		return 0644;
	case hwmon_power_reset_history:
		return 0200;
	default:
		return 0;
	}
+1 −1
Original line number Diff line number Diff line
@@ -397,7 +397,7 @@ static int tmp401_chip_read(struct device *dev, u32 attr, int channel, long *val
		ret = regmap_read(data->regmap, TMP401_CONVERSION_RATE, &regval);
		if (ret < 0)
			return ret;
		*val = (1 << (7 - regval)) * 125;
		*val = (1 << (7 - min(regval, 7))) * 125;
		break;
	case hwmon_chip_temp_reset_history:
		*val = 0;