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: <50626e29-4c86-4caf-8558-3f0288a8e22e@nabladev.com>
Date: Thu, 22 Jan 2026 12:11:57 +0100
From: Marek Vasut <marex@...ladev.com>
To: Lee Jones <lee@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
 Pascal PAILLET-LME <p.paillet@...com>, Paul Cercueil <paul@...pouillou.net>,
 Sean Nyekjaer <sean@...nix.com>, kernel@...electronics.com
Subject: Re: [PATCH v2] mfd: stpmic1: Attempt system shutdown twice in case
 PMIC is confused

On 1/20/26 6:18 PM, Lee Jones wrote:

>> +++ b/drivers/mfd/stpmic1.c
>> @@ -121,9 +121,24 @@ static const struct regmap_irq_chip stpmic1_regmap_irq_chip = {
>>   static int stpmic1_power_off(struct sys_off_data *data)
>>   {
>>   	struct stpmic1 *ddata = data->cb_data;
>> -
>> -	regmap_update_bits(ddata->regmap, MAIN_CR,
>> -			   SOFTWARE_SWITCH_OFF, SOFTWARE_SWITCH_OFF);
>> +	int i, ret;
>> +
>> +	for (i = 0; i < 2; i++) {
> 
>    for (int retries = 0; retries < MAX_RETIRES; retries++)
> 
>> +		ret = regmap_update_bits(ddata->regmap, MAIN_CR, SOFTWARE_SWITCH_OFF,
>> +					 SOFTWARE_SWITCH_OFF);
>> +		if (!ret)
>> +			return NOTIFY_DONE;
>> +
>> +		/*
>> +		 * Attempt to shut down again, in case the first attempt failed.
>> +		 * The STPMIC1 might get confused and the first regmap_update_bits()
>> +		 * returns with -ETIMEDOUT / -110 . If that or similar transient
>> +		 * failure occurs, try to shut down again. If the second attempt
>> +		 * fails, there is some bigger problem, report it to user.
>> +		 */
>> +		if (i)
>> +			dev_err(ddata->dev, "Failed to access PMIC I2C bus (%d)\n", ret);
> 
> Users aren't going to care if this works on the first or second attempt.
> 
> I would only issue the error once we've given up.
> 
> No return error in the fail case?
> 
>    define NOTIFY_DONE             0x0000          /* Don't care */
> 
> Harsh!
That is the only option, because there may be additional shutdown 
notifiers and those should also be run.

The rest is fixed in V3.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ