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: <20201027034851.GH444962@dtor-ws>
Date:   Mon, 26 Oct 2020 20:48:51 -0700
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Oleksij Rempel <o.rempel@...gutronix.de>
Cc:     Alexandru Ardelean <alexandru.ardelean@...log.com>,
        David Jander <david@...tonic.nl>, kernel@...gutronix.de,
        linux-kernel@...r.kernel.org, linux-input@...r.kernel.org
Subject: Re: [PATCH v1] Input: touchscreen: ads7846.c: Fix race that causes
 missing releases

Hi Oleksij,

On Mon, Oct 26, 2020 at 02:21:17PM +0100, Oleksij Rempel wrote:
> From: David Jander <david@...tonic.nl>
> 
> If touchscreen is released while busy reading HWMON device, the release
> can be missed. The IRQ thread is not started because no touch is active
> and BTN_TOUCH release event is never sent.
> 
> Fixes: f5a28a7d4858f94a ("Input: ads7846 - avoid pen up/down when reading hwmon")
> Co-Developed-by: David Jander <david@...tonic.nl>
> Signed-off-by: David Jander <david@...tonic.nl>
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> ---
>  drivers/input/touchscreen/ads7846.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index ea31956f3a90..0236a119c52d 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -211,10 +211,26 @@ static void ads7846_stop(struct ads7846 *ts)
>  	}
>  }
>  
> +static int get_pendown_state(struct ads7846 *ts);

Not a fan forward declarations, just move the definition if needed.

> +
>  /* Must be called with ts->lock held */
>  static void ads7846_restart(struct ads7846 *ts)
>  {
> +	unsigned int pdstate;

I do not see it being used. Do you have more patches for the driver?

> +
>  	if (!ts->disabled && !ts->suspended) {
> +		/* Check if pen was released since last stop */
> +		if (ts->pendown && !get_pendown_state(ts)) {
> +			struct input_dev *input = ts->input;
> +
> +			input_report_key(input, BTN_TOUCH, 0);
> +			input_report_abs(input, ABS_PRESSURE, 0);
> +			input_sync(input);
> +
> +			ts->pendown = false;
> +			dev_vdbg(&ts->spi->dev, "UP\n");

I wonder if we should not have ads7846_report_pen_up(struct ads7846 *ts) 

> +		}
> +
>  		/* Tell IRQ thread that it may poll the device. */
>  		ts->stopped = false;
>  		mb();
> -- 
> 2.28.0
> 

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ