linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miko Larsson <mikoxyzzz@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	"Stahl, Michael" <mstahl@moba.de>,
	linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: exc3000 - properly stop timer on shutdown
Date: Mon, 30 Jan 2023 07:17:25 +0100	[thread overview]
Message-ID: <49bcd14a3a940a0a9000c2d59b3319cd237215fe.camel@gmail.com> (raw)
In-Reply-To: <Y9dK57BFqtlf8NmN@google.com>

On Sun, 2023-01-29 at 20:43 -0800, Dmitry Torokhov wrote:
> We need to stop the timer on driver unbind or probe failures,
> otherwise
> we get UAF/Oops.
> 
> Fixes: 7e577a17f2ee ("Input: add I2C attached EETI EXC3000 multi
> touch driver")
> Reported-by: "Stahl, Michael" <mstahl@moba.de>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/touchscreen/exc3000.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/exc3000.c
> b/drivers/input/touchscreen/exc3000.c
> index 4b7eee01c6aa..69eae79e2087 100644
> --- a/drivers/input/touchscreen/exc3000.c
> +++ b/drivers/input/touchscreen/exc3000.c
> @@ -109,6 +109,11 @@ static inline void exc3000_schedule_timer(struct
> exc3000_data *data)
>         mod_timer(&data->timer, jiffies +
> msecs_to_jiffies(EXC3000_TIMEOUT_MS));
>  }
>  
> +static void exc3000_shutdown_timer(void *timer)
> +{
> +       timer_shutdown_sync(timer);
> +}
> +
>  static int exc3000_read_frame(struct exc3000_data *data, u8 *buf)
>  {
>         struct i2c_client *client = data->client;
> @@ -386,6 +391,11 @@ static int exc3000_probe(struct i2c_client
> *client)
>         if (error)
>                 return error;
>  
> +       error = devm_add_action_or_reset(&client->dev,
> exc3000_shutdown_timer,
> +                                        &data->timer);
> +       if (error)
> +               return error;
> +
>         error = devm_request_threaded_irq(&client->dev, client->irq,
>                                           NULL, exc3000_interrupt,
> IRQF_ONESHOT,
>                                           client->name, data);
> -- 
> 2.39.1.456.gfc5497dd1b-goog
> 
> 

This should probably be Cc'ed to the stable mailing list.
-- 
~miko

      reply	other threads:[~2023-01-30  6:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  4:43 [PATCH] Input: exc3000 - properly stop timer on shutdown Dmitry Torokhov
2023-01-30  6:17 ` Miko Larsson [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=49bcd14a3a940a0a9000c2d59b3319cd237215fe.camel@gmail.com \
    --to=mikoxyzzz@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mstahl@moba.de \
    /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).