From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Johnny Chuang <johnny.chuang@emc.com.tw>
Subject: Re: [PATCH] Input: elants_i2c - Avoid divide by 0 errors on bad touchscreen data
Date: Thu, 5 Jan 2017 14:18:48 -0800 [thread overview]
Message-ID: <20170105221848.GB20478@dtor-ws> (raw)
In-Reply-To: <1483640265-688-1-git-send-email-linux@roeck-us.net>
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
prev parent reply other threads:[~2017-01-05 22:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 18:17 [PATCH] Input: elants_i2c - Avoid divide by 0 errors on bad touchscreen data Guenter Roeck
2017-01-05 22:18 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170105221848.GB20478@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=johnny.chuang@emc.com.tw \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).