Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1552374

Re: [PATCH] Input: elants_i2c - Avoid divide by 0 errors on bad touchscreen data

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Input: elants_i2c - Avoid divide by 0 errors on bad touchscreen data
Date 2017-01-05 23:30 +0100
Message-ID <sWoHM-Jf-5@gated-at.bofh.it> (permalink)
References <sWkXw-6FL-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jan 05, 2017 at 10:17:45AM -0800, Guenter Roeck wrote:
> The following crash may be seen if bad data is received from the
> touchscreen.
> 
> [ 2189.425150] elants_i2c i2c-ELAN0001:00: unknown packet ff ff ff ff
> [ 2189.430738] divide error: 0000 [#1] PREEMPT SMP
...
> 
> The problem was seen with a 3.18 based kernel, but there is no reason
> to believe that the upstream code is safe.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Applied and marked for stable, thank you.

> ---
>  drivers/input/touchscreen/elants_i2c.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index 02aec284deca..3e6003d32e56 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -914,9 +914,9 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev)
>  
>  		case QUEUE_HEADER_NORMAL:
>  			report_count = ts->buf[FW_HDR_COUNT];
> -			if (report_count > 3) {
> +			if (report_count == 0 || report_count > 3) {
>  				dev_err(&client->dev,
> -					"too large report count: %*ph\n",
> +					"bad report count: %*ph\n",
>  					HEADER_SIZE, ts->buf);
>  				break;
>  			}
> -- 
> 2.7.4
> 

-- 
Dmitry

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] Input: elants_i2c - Avoid divide by 0 errors on bad touchscreen data Guenter Roeck <linux@roeck-us.net> - 2017-01-05 19:30 +0100
  Re: [PATCH] Input: elants_i2c - Avoid divide by 0 errors on bad  touchscreen data Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-05 23:30 +0100

csiph-web