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] [day] [month] [year] [list]
Message-ID: <49df3a4a-1a32-467e-b8da-25e1e7093979@roeck-us.net>
Date: Mon, 24 Nov 2025 11:49:12 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Gui-Dong Han <hanguidong02@...il.com>
Cc: vt8231@...denengine.co.uk, linux-hwmon@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: (vt8231) Convert macros to functions to avoid
 TOCTOU

On Tue, Nov 25, 2025 at 12:59:00AM +0800, Gui-Dong Han wrote:
> The macro FAN_FROM_REG evaluates its arguments multiple times. When used
> with shared driver data, this leads to Time-of-Check to Time-of-Use
> (TOCTOU) race conditions, potentially causing divide-by-zero errors.
> 
> Convert the macro to a static function to ensure arguments are evaluated
> only once.
> 
> Additionally, in fan_div_store, move the reading of the old register
> value and the calculation of the minimum limit inside the update lock.
> This ensures that the read-modify-write sequence operates on consistent
> data, preventing race conditions during fan divider updates.
> 
> Link: https://lore.kernel.org/all/CALbr=LYJ_ehtp53HXEVkSpYoub+XYSTU8Rg=o1xxMJ8=5z8B-g@mail.gmail.com/
> Signed-off-by: Gui-Dong Han <hanguidong02@...il.com>
> ---

Applied.

Thanks,
Guenter

...
> +	old = vt8231_read_value(data, VT8231_REG_FANDIV);
> +	min = fan_from_reg(data->fan_min[nr],
> +			DIV_FROM_REG(data->fan_div[nr]));

That line split was now unnecessary. Dropped while applying.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ