lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49d2ceb3-24f2-4cef-841c-392595f66c92@roeck-us.net>
Date: Thu, 13 Jun 2024 06:44:06 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Naresh Solanki <naresh.solanki@...ements.com>
Cc: Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] hwmon: (max6639) : Add hwmon attributes for fan
 and pwm

On 6/13/24 02:51, Naresh Solanki wrote:
...
>>
>>> +     switch (attr) {
>>> +     case hwmon_fan_pulses:
>>> +             if (val <= 0 || val > 5)
>>> +                     return -EINVAL;
>>> +
>>> +             /* Set Fan pulse per revolution */
>>> +             err = max6639_set_ppr(data, channel, val);
>>> +             if (err < 0)
>>> +                     return err;
>>> +
>>> +             data->ppr[channel] = val;
>>
>> Needs mutex protection to avoid inconsistencies due to concurrent writes.
> This is single i2c access. Still we need mutex protection here ?

In this case, the mutex doesn't protect the i2c access, it protects the
consistency between the chip configuration and the information stored
in data->ppr[].

CPU1			CPU2
[val==1]		[val!=1]

max6639_set_ppr();
			max6639_set_ppr();
			data->ppr[channel] = val;
data->ppr[channel] = val;

The alternative would be to not cache ppr and read it from the regmap cache
when needed.

Guenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ