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: <t_cZwIcdajFYTSx2_B2UCOxOZLfPVBz3goQ7mtcy1g1lyok_u0sGB5nKWhZ2AX0p4-_EhwMwjGzp50wv3SYfNa3PJQWrhkk3AN5MisD9TJg=@protonmail.com>
Date:   Thu, 15 Oct 2020 10:33:50 +0000
From:   Barnabás Pőcze <pobrn@...tonmail.com>
To:     Coiby Xu <coiby.xu@...il.com>
Cc:     "linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
        Jiri Kosina <jikos@...nel.org>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] HID: i2c-hid: add polling mode based on connected GPIO chip's pin status

Hi,

I believe this patch causes I2C HID devices not to work with IRQs after resuming
from suspend.


> [...]
>  #ifdef CONFIG_PM_SLEEP
> @@ -1183,7 +1292,8 @@ static int i2c_hid_suspend(struct device *dev)
>  	/* Save some power */
>  	i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
>
> -	disable_irq(client->irq);
> +	if (polling_mode == I2C_POLLING_DISABLED)
> +		disable_irq(client->irq);
>

The IRQ is disabled when suspending if polling is *off*.


>  	if (device_may_wakeup(&client->dev)) {
>  		wake_status = enable_irq_wake(client->irq);
> @@ -1216,7 +1326,7 @@ static int i2c_hid_resume(struct device *dev)
>
>  		if (ihid->pdata.post_power_delay_ms)
>  			msleep(ihid->pdata.post_power_delay_ms);
> -	} else if (ihid->irq_wake_enabled) {
> +	} else if (ihid->irq_wake_enabled && polling_mode != I2C_POLLING_DISABLED) {

As a side note, I'm not sure if the 'polling_mode != I2C_POLLING_DISABLED' part
is necessary (or that it's necessary *here*). It causes 'i2c_hid_resume' and
'i2c_hid_suspend' to be "asymmetric" which - I believe - may cause problems.


>  		wake_status = disable_irq_wake(client->irq);
>  		if (!wake_status)
>  			ihid->irq_wake_enabled = false;
> @@ -1225,7 +1335,8 @@ static int i2c_hid_resume(struct device *dev)
>  				wake_status);
>  	}
>
> -	enable_irq(client->irq);
> +	if (polling_mode != I2C_POLLING_DISABLED)
> +		enable_irq(client->irq);
>

The IRQ is enabled when resuming if polling is *on*. It should be enabled if polling is *off*
in my opinion.


> [...]


Regards,
Barnabás Pőcze

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ