Re: [PATCH] i801_smbus: clear SMBALERT status bit and disable SMBALERT interrupt

From: Sverdlin, Alexander (Nokia - DE/Ulm)
Date: Mon Sep 16 2019 - 05:29:33 EST


Hi Jean,

On 05/09/2019 14:57, Jean Delvare wrote:
> If this is of any value to you, I tried implementing it in i2c-i801 a
> few days ago. I can't really test it though as I don't have any device
> which triggers an alert on my system, but I am sharing it with you if
> you want to give it a try. You would still need to write the code in
> the slave driver.

and I forgot another issue:

> @@ -1897,8 +1956,10 @@ static void i801_remove(struct pci_dev *
> pm_runtime_forbid(&dev->dev);
> pm_runtime_get_noresume(&dev->dev);
>
> - i801_disable_host_notify(priv);
> + i801_restore_slvcmd(priv);
> i801_del_mux(priv);
> + if (priv->ara)
> + i2c_unregister_device(priv->ara);

to me it looks like a race with IRQ handler (IRQ is only disabled *after*
remove()), it can still attempt to use freed ARA device after this line.

> i2c_del_adapter(&priv->adapter);
> i801_acpi_remove(priv);
> pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg);

--
Best regards,
Alexander Sverdlin.